Linux SSH - Lost connection
Hi guys,
I have a weird issue: I have 3 PCs, they have the following IPs addresses and the related OS: 192.168.1.10 Ubuntu 192.168.1.11 Debian 192.168.1.12 Kubuntu When I try to transfer a file from the .12 to the .11 no problem at all, but when I want to transfer a file from .10 to the .11 I get the following error message: Connection closed by 192.168.1.11 lost connection Here is the /etc/ssh/sshd_config file of the .11 machine: # Package generated configuration file # See the sshd_config(5) manpage for details # What ports, IPs and protocols we listen for Port 22 # Use these options to restrict which interfaces/protocols sshd will bind to #ListenAddress :: ListenAddress 0.0.0.0 Protocol 2 # HostKeys for protocol version 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key #Privilege Separation is turned on for security UsePrivilegeSeparation yes # Lifetime and size of ephemeral version 1 server key KeyRegenerationInterval 3600 ServerKeyBits 1024 # Logging SyslogFacility AUTH LogLevel INFO # Authentication: LoginGraceTime 10 PermitRootLogin no StrictModes yes RSAAuthentication yes PubkeyAuthentication yes #AuthorizedKeysFile %h/.ssh/authorized_keys # Don't read the user's ~/.rhosts and ~/.shosts files IgnoreRhosts yes # For this to work you will also need host keys in /etc/ssh_known_hosts RhostsRSAAuthentication no # similar for protocol version 2 HostbasedAuthentication no # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication #IgnoreUserKnownHosts yes # To enable empty passwords, change to yes (NOT RECOMMENDED) PermitEmptyPasswords no # Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication no # Change to no to disable tunnelled clear text passwords #PasswordAuthentication yes # Kerberos options #KerberosAuthentication no #KerberosGetAFSToken no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes # GSSAPI options #GSSAPIAuthentication no #GSSAPICleanupCredentials yes X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes #UseLogin no #MaxStartups 10:30:60 #Banner /etc/issue.net # Allow client to pass locale environment variables AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server # Set this to 'yes' to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of "PermitRootLogin without-password". # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to 'no'. UsePAM yes In my opinion everything looks fine as of the line ListenAddress 0.0.0.0 but why I get connection closed?? Why the .11 refuses the connection only from the .10 and not from the .12 machine?? I have tried to reinstall the ssh. There is no firewall and no iptables configured. Thanks fr2632 |
you need to look at the log files on the destination for information about this. That's why log files exist. check /var/log/secure and /var/log/messages
|
Quote:
The file /var/log/secure does not exist, and the /var/log/messages says just this: Jan 31 08:03:10 fr2632 rsyslogd: [origin software="rsyslogd" swVersion="4.6.4" x-pid="1044" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'. Not really helpful message I guess :( |
There's nothing there??? how is that possible? there should always be something in there. Every single time you log in there should be a handful of entries in that logfile.
So why there's nothing logged is one thing you should investigate, but if you get the command line of the sshd process you're connecting to, from "ps -ef" etc, and run that command with a -D added to it (after stopping sshd first) and that'll run it in the foreground spitting out hopefully useful information. |
Quote:
With the command ps -ef I dont see what is really wrong with ssh connection and why I get lost connection message. What do you mean with "run that command with a -D added to it" ? However I tried to run the scp command with -vvv again from .10 to .11 and this is the results: fr2632@fr2632:~$ scp -r -vvv textfile fr2632@192.168.1.11:"/home/fr2632/Documents" Executing: program /usr/bin/ssh host 192.168.1.11, user fr2632, command scp -v -r -d -t -- /home/fr2632/Documents OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to 192.168.1.11 [192.168.1.11] port 22. debug1: Connection established. debug1: identity file /home/fr2632/.ssh/id_rsa type -1 debug1: identity file /home/fr2632/.ssh/id_rsa-cert type -1 debug1: identity file /home/fr2632/.ssh/id_dsa type -1 debug1: identity file /home/fr2632/.ssh/id_dsa-cert type -1 debug1: identity file /home/fr2632/.ssh/id_ecdsa type -1 debug1: identity file /home/fr2632/.ssh/id_ecdsa-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze2 debug1: match: OpenSSH_5.5p1 Debian-6+squeeze2 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1 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: Server host key: RSA e7:0f:9a:bc:e6:b7:6d:6d:70:ad:f5:71:e4:4c:b1:00 debug1: Host '192.168.1.11' is known and matches the RSA host key. debug1: Found key in /home/fr2632/.ssh/known_hosts:2 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server 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: /home/fr2632/.ssh/id_rsa debug1: Trying private key: /home/fr2632/.ssh/id_dsa debug1: Trying private key: /home/fr2632/.ssh/id_ecdsa debug1: Next authentication method: password fr2632@192.168.1.11's password: Connection closed by 192.168.1.11 lost connection fr2632@fr2632:~$ |
Your SSH logs will be in /var/log/auth.log
|
Quote:
Jan 31 16:46:11 fr2632 sudo: fr2632 : TTY=pts/2 ; PWD=/home/fr2632 ; USER=root ; COMMAND=/usr/bin/nano /var/log/auth.log Jan 31 16:46:40 fr2632 sshd[18993]: debug1: Forked child 22002. Jan 31 16:46:40 fr2632 sshd[22002]: Set /proc/self/oom_adj to 0 Jan 31 16:46:40 fr2632 sshd[22002]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7 Jan 31 16:46:40 fr2632 sshd[22002]: debug1: inetd sockets after dupping: 3, 3 Jan 31 16:46:40 fr2632 sshd[22002]: Connection from 192.168.1.10 port 51850 Jan 31 16:46:40 fr2632 sshd[22002]: debug1: Client protocol version 2.0; client software version OpenSSH_5.9p1 Debian-5ubuntu1 Jan 31 16:46:40 fr2632 sshd[22002]: debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH* Jan 31 16:46:40 fr2632 sshd[22002]: debug1: Enabling compatibility mode for protocol 2.0 Jan 31 16:46:40 fr2632 sshd[22002]: debug1: Local version string SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze2 Jan 31 16:46:41 fr2632 sshd[22002]: debug1: PAM: initializing for "fr2632" Jan 31 16:46:41 fr2632 sshd[22002]: debug1: PAM: setting PAM_RHOST to "fr2632.local" Jan 31 16:46:41 fr2632 sshd[22002]: debug1: PAM: setting PAM_TTY to "ssh" Jan 31 16:46:41 fr2632 sshd[22002]: Failed none for fr2632 from 192.168.1.10 port 51850 ssh2 Jan 31 16:46:46 fr2632 sshd[22002]: debug1: PAM: password authentication accepted for fr2632 Jan 31 16:46:46 fr2632 sshd[22002]: debug1: do_pam_account: called Jan 31 16:46:46 fr2632 sshd[22002]: Accepted password for fr2632 from 192.168.1.10 port 51850 ssh2 Jan 31 16:46:46 fr2632 sshd[22002]: debug1: monitor_child_preauth: fr2632 has been authenticated by privileged process Jan 31 16:46:46 fr2632 sshd[22002]: debug1: PAM: establishing credentials Jan 31 16:46:46 fr2632 sshd[22002]: pam_unix(sshd:session): session opened for user fr2632 by (uid=0) Jan 31 16:46:47 fr2632 sshd[22002]: User child is on pid 22007 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: SELinux support disabled Jan 31 16:46:47 fr2632 sshd[22007]: debug1: PAM: establishing credentials Jan 31 16:46:47 fr2632 sshd[22007]: debug1: permanently_set_uid: 1000/1000 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: Entering interactive session for SSH2. Jan 31 16:46:47 fr2632 sshd[22007]: debug1: server_init_dispatch_20 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: server_input_channel_open: ctype session rchan 0 win 2097152 max 32768 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: input_session_request Jan 31 16:46:47 fr2632 sshd[22007]: debug1: channel 0: new [server-session] Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_new: session 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_open: channel 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_open: session 0: link with channel 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: server_input_channel_open: confirm session Jan 31 16:46:47 fr2632 sshd[22007]: debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: server_input_channel_req: channel 0 request env reply 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_by_channel: session 0 channel 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_input_channel_req: session 0 req env Jan 31 16:46:47 fr2632 sshd[22007]: debug1: server_input_channel_req: channel 0 request exec reply 1 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_by_channel: session 0 channel 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_input_channel_req: session 0 req exec Jan 31 16:46:47 fr2632 sshd[22007]: debug1: Received SIGCHLD. Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_by_pid: pid 22008 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_exit_message: session 0 channel 0 pid 22008 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_exit_message: release channel 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_by_channel: session 0 channel 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_close_by_channel: channel 0 child 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: session_close: session 0 pid 0 Jan 31 16:46:47 fr2632 sshd[22007]: debug1: channel 0: free: server-session, nchannels 1 Jan 31 16:46:47 fr2632 sshd[22007]: Received disconnect from 192.168.1.10: 11: disconnected by user Jan 31 16:46:47 fr2632 sshd[22007]: debug1: do_cleanup Jan 31 16:46:47 fr2632 sshd[22002]: debug1: do_cleanup Jan 31 16:46:47 fr2632 sshd[22002]: debug1: PAM: cleanup Jan 31 16:46:47 fr2632 sshd[22002]: debug1: PAM: closing session Jan 31 16:46:47 fr2632 sshd[22002]: pam_unix(sshd:session): session closed for user fr2632 Jan 31 16:46:47 fr2632 sshd[22002]: debug1: PAM: deleting credentials Jan 31 16:47:13 fr2632 sudo: fr2632 : TTY=pts/2 ; PWD=/home/fr2632 ; USER=root ; COMMAND=/usr/bin/nano /var/log/auth.log NOTE: line:"Jan 31 16:46:47 fr2632 sshd[22007]: Received disconnect from 192.168.1.10: 11: disconnected by user" Obviously I didnt disconnect it... |
Anyone ??
|
It's says it recieves a SIGCHLD, so it's the child process on the server stopping. This doesn't really figure when it is client specific. Are you able to run the sftp-server process as the correct destination user on the server itself? Are you using the same user account?
|
Quote:
Yes, I am using the same user and I can sftp, ftp and ping the .10 machine without any problems ... |
can you actually run sftp-server on the server directly?
Doesn't feel plausiblem, but there's nothing quirky in /etc/hosts.allow / hosts.deny? Also there is, i blieve, deeper debugging you can still enable on the server side. some posts online show some potentially interesting debug3 statements, trey a -d 3 flag on the server process. |
Quote:
sftp fr2632@192.168.1.10 fr2632@192.168.1.10's password: Connected to 192.168.1.10. sftp> The other way around (from .10 to .12): sftp fr2632v3@192.168.1.12 fr2632v3@192.168.1.12's password: Connected to 192.168.1.12. sftp> |
Quote:
|
Quote:
"UsePAM yes" On both .10 and .11 machines. Is there a way how to check PAM for more details ? Thanks :) |
Quote:
Make sure you have access to the consoles of the servers you are working on. If any thing goes wrong and if you cannot connect to the remote servers via ssh you revert back the changes via console. |
All times are GMT -5. The time now is 12:21 AM. |