SSH remote login problems

Discussion in 'macOS' started by jonat8, Sep 2, 2005.

  1. jonat8 macrumors regular

    Joined:
    Dec 17, 2004
    Location:
    United Kingdom
    #1
    Hi,

    Trying to log into my mac mini from the powerbook using SSH over my private LAN. I have enabled remote login on the mac mini in system preferences and on the powerbook in a Terminal session, I type ssh username@192.168.1.4 and then the client waits for what seems like a minute or so before popping up with:

    "The authenticity of host '192.168.1.4' can't be established"
    "RSA key fingerprint is: xxx"
    "Are you sure you want to continue connecting (yes/no)"

    I enter "yes" and then I get:

    "Warning: Permenantly added 192.168.1.4 (RSA) to the list of known hosts.

    Then

    "Connection closed by 192.168.1.4"

    and I can't get any further.
    I have tried enabling Remote Login on the powerbook and trying the other way round, just to test and I get the same thing (although the IP addresses are different)

    Can anyone help?
    Thanks :)
     
  2. iMeowbot macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #2
    It may help if you start up Utilities:Console on the system where you are trying to log in, and check for interesting messages in either console.log or system.log at the time the login fails.
     
  3. jonat8 thread starter macrumors regular

    Joined:
    Dec 17, 2004
    Location:
    United Kingdom
    #3
    This interesting snipping is coming from system.log:

    Code:
    Sep  2 15:27:47 Jonathan-Lovatts-Computer sshd[1182]: error: Bind to port 22 on 0.0.0.0 failed: Permission denied.
    Sep  2 15:27:47 Jonathan-Lovatts-Computer sshd[1182]: fatal: Cannot bind any address.
    Sep  2 15:28:17 Jonathan-Lovatts-Computer mDNSResponder: Service "Jonathan Lovatt’s Computer._sftp-ssh._tcp.local." renamed to "Jonathan Lovatt’s Computer (2)"
    Sep  2 15:28:17 Jonathan-Lovatts-Computer mDNSResponder: Service "Jonathan Lovatt’s Computer._ssh._tcp.local." renamed to "Jonathan Lovatt’s Computer (2)"
    Sep  2 15:28:17 Jonathan-Lovatts-Computer mDNSResponder: Service "Jonathan Lovatt’s Computer._afpovertcp._tcp.local." renamed to "Jonathan Lovatt’s Computer (2)"
    Sep  2 15:28:18 Jonathan-Lovatts-Computer mDNSResponder: Updating Computer Name from "Jonathan Lovatt’s Computer" to "Jonathan Lovatt’s Computer (2)"
    Sep  2 15:30:44 Jonathan-Lovatts-Computer sshd[1237]: fatal: Timeout before authentication for 192.168.1.4
    If i do sudo ssh jonathanlovatt@192.168.1.4 then it asks me for the password then hangs for a bit and then comes up with the same problem as in my original post.

    thanks for any suggestions :)
     
  4. belvdr macrumors 601

    Joined:
    Aug 15, 2005
    #4
    Do a:

    netstat -an | grep -e ':22'

    from Terminal to see if port 22 is already bound by another program.

    My mac is not currently present in front of me, but you may be able to find the offending program using lsof.

    IIRC:

    lsof -i4 -p | grep LIST

    and search for port 22

    EDIT: Do both of the Macs have the same name? That may be your problem.
     
  5. jonat8 thread starter macrumors regular

    Joined:
    Dec 17, 2004
    Location:
    United Kingdom
    #5
    Hi,

    Sorry for the delay in replying.

    The netstat command just runs and dumps me back on the jonathanlovatt$ waiting for command prompt again, so I'm assuming nothing is bound on that port.

    The names of the computers WERE the same, I have changed them now and I no longer get the multitude of errors I was getting before. What is happening now is that when I do ssh jonathanlovatt@192.168.1.4 it hangs for ages then says "Connection closed by remote host". If I look in the system.log of the machine I am trying to connect TO, I see:

    Sep 3 07:24:39 Jonathans-Mac-mini sshd[570]: fatal: Timeout before authentication for 192.168.1.2

    It's the same the other way round too. I found a hint here: http://www.macosxhints.com/article.php?story=20050503190955329&query=ssh+IPv6 that suggests it might be something to do with IPv6 lookups and I did what it suggested but still no joy.

    I'm really confused now, I can't figure out why it's not working. It must be a network issue somewhere, if I do ssh jonathanlovatt@localhost it works fine.

    My router/switch is a D-Link G640T ADSL router, the Powerbook is using AirPort and the mac mini is connected via Ethernet. They have no problem VNC'ing between each other or sharing files, just the SSH.

    Any advice appreciated :) I'm close to tearing my hair out on this one lol.
     
  6. Jeewhizz macrumors regular

    Joined:
    Nov 30, 2003
    Location:
    London, UK
    #6
    run ssh in verbose mode - its your friend ;)

    shh -v admin@192.168.1.1

    Paste the contents in here :)
     
  7. sbouloc macrumors newbie

    Joined:
    Jan 15, 2010
    #7
    ssh connection closed

    Hello all,

    This thread is quite old but I have run into a similar problem when trying to connect to my readynas via ssh. So I have run the command:
    Code:
    shh -v admin@192.168.1.253
    and here's what I get:
    Code:
    OpenSSH_5.2p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 192.168.1.253 [192.168.1.253] port 22.
    debug1: Connection established.
    debug1: identity file /Users/sbouloc/.ssh/identity type -1
    debug1: identity file /Users/sbouloc/.ssh/id_rsa type -1
    debug1: identity file /Users/sbouloc/.ssh/id_dsa type -1
    debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-5~bpo.1.netgear1
    debug1: match: OpenSSH_4.3p2 Debian-5~bpo.1.netgear1 pat OpenSSH_4*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_5.2
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-ctr hmac-md5 none
    debug1: kex: client->server aes128-ctr hmac-md5 none
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Host '192.168.1.253' is known and matches the RSA host key.
    debug1: Found key in /Users/sbouloc/.ssh/known_hosts:1
    debug1: ssh_rsa_verify: signature correct
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_SERVICE_REQUEST sent
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey,password
    debug1: Next authentication method: publickey
    debug1: Trying private key: /Users/sbouloc/.ssh/identity
    debug1: Trying private key: /Users/sbouloc/.ssh/id_rsa
    debug1: Trying private key: /Users/sbouloc/.ssh/id_dsa
    debug1: Next authentication method: password
    admin@192.168.1.253's password: 
    debug1: Authentication succeeded (password).
    debug1: channel 0: new [client-session]
    debug1: Entering interactive session.
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    Linux nas-10-1E-FA 2.6.17.8ReadyNAS #1 Tue Jun 9 13:59:28 PDT 2009 padre unknown
    debug1: channel 0: free: client-session, nchannels 1
    Connection to 192.168.1.253 closed.
    Transferred: sent 1728, received 2208 bytes, in 0.1 seconds
    Bytes per second: sent 28178.7, received 36006.1
    debug1: Exit status 0
    
    Mac OS X 10.5.8
    EnableRootSSH_1.0 installed on the readynas

    Thank you for your help.
     
  8. sbouloc macrumors newbie

    Joined:
    Jan 15, 2010
    #8
    Don't pay attention to the previous post. I was using the wrong command. Should have typed
    Code:
    shh root@192.168.1.253
    instead of admin.
    Works fine
     

Share This Page