[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Why does my ssh session terminate immediately?



Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Hi Jean-Marc,
>
> thanks for your suggestions.  See the results inline.
>
> Jean-Marc <jean-marc@6jf.be> writes:
>
>> On Wed, 24 Apr 2013 05:03:53 +0200, Andreas Leha
>> <andreas.leha@med.uni-goettingen.de> wrote:
>> Hi Andreas,
>>
>> Did you check your sshd config' ?
>> You can do it running:
>> sshd -t
>
> I get nothing -- which I think is good in this case.
>
>>
>> You can also make tests by running you sshd in debug mode.
>> Just start it on another port to not disturb the main one:
>> sshd -de -p 8022
>>
>> and try a connection on this SSH from your client:
>> ssh -p 8022 yourhost
>>
>> and check what happens on your server.
>>
>
> I did that, here is the result:
>
> ,----[ on the server -- before a connection attempt ]
> | > /usr/sbin/sshd -de -p 8022
> | debug1: sshd version OpenSSH_5.5p1 Debian-6+squeeze3
> | debug1: read PEM private key done: type RSA
> | debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
> | debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
> | debug1: private host key: #0 type 1 RSA
> | debug1: read PEM private key done: type DSA
> | debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
> | debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
> | debug1: private host key: #1 type 2 DSA
> | debug1: rexec_argv[0]='/usr/sbin/sshd'
> | debug1: rexec_argv[1]='-de'
> | debug1: rexec_argv[2]='-p'
> | debug1: rexec_argv[3]='8022'
> | Set /proc/self/oom_adj from 0 to -17
> | debug1: Bind to port 8022 on 0.0.0.0.
> | Server listening on 0.0.0.0 port 8022.
> | debug1: Bind to port 8022 on ::.
> | Server listening on :: port 8022.
> `----
>
> ,----[ on the server -- during a connection attempt ]
> | debug1: Server will not fork when running in debugging mode.
> | debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
> | debug1: sshd version OpenSSH_5.5p1 Debian-6+squeeze3
> | debug1: read PEM private key done: type RSA
> | debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
> | debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
> | debug1: private host key: #0 type 1 RSA
> | debug1: read PEM private key done: type DSA
> | debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
> | debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
> | debug1: private host key: #1 type 2 DSA
> | debug1: inetd sockets after dupping: 3, 3
> | Connection from 192.168.2.101 port 55650
> | debug1: Client protocol version 2.0; client software version OpenSSH_6.0p1 Debian-4
> | debug1: match: OpenSSH_6.0p1 Debian-4 pat OpenSSH*
> | debug1: Enabling compatibility mode for protocol 2.0
> | debug1: Local version string SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze3
> | debug1: permanently_set_uid: 101/65534
> | debug1: list_hostkey_types: ssh-rsa,ssh-dss
> | debug1: SSH2_MSG_KEXINIT sent
> | debug1: SSH2_MSG_KEXINIT received
> | debug1: kex: client->server aes128-ctr hmac-md5 none
> | debug1: kex: server->client aes128-ctr hmac-md5 none
> | debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
> | debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
> | debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
> | debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
> | debug1: SSH2_MSG_NEWKEYS sent
> | debug1: expecting SSH2_MSG_NEWKEYS
> | debug1: SSH2_MSG_NEWKEYS received
> | debug1: KEX done
> | debug1: userauth-request for user root service ssh-connection method none
> | debug1: attempt 0 failures 0
> | debug1: PAM: initializing for "root"
> | debug1: PAM: setting PAM_RHOST to "192.168.2.101"
> | debug1: PAM: setting PAM_TTY to "ssh"
> | Failed none for root from 192.168.2.101 port 55650 ssh2
> | debug1: userauth-request for user root service ssh-connection method publickey
> | debug1: attempt 1 failures 0
> | debug1: test whether pkalg/pkblob are acceptable
> | debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
> | debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
> | debug1: temporarily_use_uid: 0/0 (e=0/0)
> | debug1: trying public key file /root/.ssh/authorized_keys
> | debug1: fd 4 clearing O_NONBLOCK
> | debug1: matching key found: file /root/.ssh/authorized_keys, line 1
> | Found matching RSA key: 47:7c:14:dd:25:54:14:0d:d8:cf:c5:24:44:d4:7b:c2
> | debug1: restore_uid: 0/0
> | Postponed publickey for root from 192.168.2.101 port 55650 ssh2
> | debug1: userauth-request for user root service ssh-connection method publickey
> | debug1: attempt 2 failures 0
> | debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
> | debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
> | debug1: temporarily_use_uid: 0/0 (e=0/0)
> | debug1: trying public key file /root/.ssh/authorized_keys
> | debug1: fd 4 clearing O_NONBLOCK
> | debug1: matching key found: file /root/.ssh/authorized_keys, line 1
> | Found matching RSA key: 47:7c:14:dd:25:54:14:0d:d8:cf:c5:24:44:d4:7b:c2
> | debug1: restore_uid: 0/0
> | debug1: ssh_rsa_verify: signature correct
> | debug1: do_pam_account: called
> | Accepted publickey for root from 192.168.2.101 port 55650 ssh2
> | debug1: monitor_child_preauth: root has been authenticated by privileged process
> | debug1: PAM: establishing credentials
> | debug1: Entering interactive session for SSH2.
> | debug1: server_init_dispatch_20
> | debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384
> | debug1: input_session_request
> | debug1: channel 0: new [server-session]
> | debug1: session_new: session 0
> | debug1: session_open: channel 0
> | debug1: session_open: session 0: link with channel 0
> | debug1: server_input_channel_open: confirm session
> | debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0
> | debug1: server_input_channel_req: channel 0 request pty-req reply 1
> | debug1: session_by_channel: session 0 channel 0
> | debug1: session_input_channel_req: session 0 req pty-req
> | debug1: Allocating pty.
> | debug1: session_pty_req: session 0 alloc /dev/pts/0
> | debug1: SELinux support disabled
> | debug1: server_input_channel_req: channel 0 request env reply 0
> | debug1: session_by_channel: session 0 channel 0
> | debug1: session_input_channel_req: session 0 req env
> | debug1: server_input_channel_req: channel 0 request shell reply 1
> | debug1: session_by_channel: session 0 channel 0
> | debug1: session_input_channel_req: session 0 req shell
> | debug1: Setting controlling tty using TIOCSCTTY.
> | debug1: Received SIGCHLD.
> | debug1: session_by_pid: pid 895
> | debug1: session_exit_message: session 0 channel 0 pid 895
> | debug1: session_exit_message: release channel 0
> | debug1: session_pty_cleanup: session 0 release /dev/pts/0
> | debug1: session_by_channel: session 0 channel 0
> | debug1: session_close_by_channel: channel 0 child 0
> | debug1: session_close: session 0 pid 0
> | debug1: channel 0: free: server-session, nchannels 1
> | Received disconnect from 192.168.2.101: 11: disconnected by user
> | debug1: do_cleanup
> | debug1: PAM: cleanup
> | debug1: PAM: closing session
> | debug1: PAM: deleting credentials
> `----
>
> ,----[ on the client side ]
> | > ssh -p 8022 root@192.168.2.109 
> | Linux debian 2.6.32-5-kirkwood #1 Sun May 6 16:57:51 UTC 2012 armv5tel
> | 
> | The programs included with the Debian GNU/Linux system are free software;
> | the exact distribution terms for each program are described in the
> | individual files in /usr/share/doc/*/copyright.
> | 
> | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
> | permitted by applicable law.
> | Last login: Wed Apr 24 02:54:10 2013 from 192.168.2.101
> | debug1: PAM: reinitializing credentials
> | debug1: permanently_set_uid: 0/0
> | Environment:
> |   LANG=C
> |   USER=root
> |   LOGNAME=root
> |   HOME=/root
> |   PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
> |   MAIL=/var/mail/root
> |   SHELL=/bin/bash
> |   SSH_CLIENT=192.168.2.101 55650 8022
> |   SSH_CONNECTION=192.168.2.101 55650 192.168.2.109 8022
> |   SSH_TTY=/dev/pts/0
> |   TERM=screen
> | Connection to 192.168.2.109 closed
> `----
>
>
> So it says 'disconnected by user'?  I might mention, that can login to
> (all) other machines with that client without problems.
>

Just to add another comment here:  I also get the same problem when I
try to connect from my Android phone using ConnectBot.

I see the greeting text and get disconnected immediately.
The message is in German "Die Verbindung wurde getrennt", but it means
the same as "Connection closed".

Regards,
Andreas


Reply to: