You are not logged in.

#1 2016-02-28 22:03:42

samuelrey
Member
Registered: 2015-10-06
Posts: 10

OpenSSH Connection Reset by [IP ADDR]

From my Windows 10 desktop, I can SSH into my Arch box just fine. But while I am working, the session will freeze and die, saying

Connection Reset by 10.0.0.42

I am using Cygwin on my desktop and OpenSSH on both computers.

Local computer

$ ssh -V
OpenSSH_7.1p1, OpenSSL 1.0.2f  28 Jan 2016

Server

$ ssh -V
OpenSSH_7.1p2, OpenSSL 1.0.2f  28 Jan 2016

I also checked the output of

$ssh -vvv 10.0.0.42
OpenSSH_7.1p1, OpenSSL 1.0.2f  28 Jan 2016
debug1: Reading configuration data /etc/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.0.0.42 [10.0.0.42] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/psycho/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/psycho/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/psycho/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/psycho/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/psycho/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/psycho/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/psycho/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/psycho/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1
debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 10.0.0.42:22 as 'psycho'
debug3: hostkeys_foreach: reading file "/home/psycho/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/psycho/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 10.0.0.42
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa
debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: kex_parse_kexinit: ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:xnSU9X/K0AESgHKVwWRt1nYD2VmzNqQ7zIZnJtXo4MI
debug3: hostkeys_foreach: reading file "/home/psycho/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/psycho/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 10.0.0.42
debug1: Host '10.0.0.42' is known and matches the ECDSA host key.
debug1: Found key in /home/psycho/.ssh/known_hosts:1
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/psycho/.ssh/id_rsa (0x0),
debug2: key: /home/psycho/.ssh/id_dsa (0x0),
debug2: key: /home/psycho/.ssh/id_ecdsa (0x0),
debug2: key: /home/psycho/.ssh/id_ed25519 (0x0),
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/psycho/.ssh/id_rsa
debug3: no such identity: /home/psycho/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/psycho/.ssh/id_dsa
debug3: no such identity: /home/psycho/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/psycho/.ssh/id_ecdsa
debug3: no such identity: /home/psycho/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/psycho/.ssh/id_ed25519
debug3: no such identity: /home/psycho/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
psycho@10.0.0.42's password:
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to 10.0.0.42 ([10.0.0.42]:22).
debug2: fd 5 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0

But I am not exactly sure what to look for. I did notice

debug1: key_load_public: No such file or directory

and

debug3: no such identity: /home/psycho/.ssh/id_rsa: No such file or directory

but don't know what to make of it.

I looked into timeouts, but that doesn't look exactly right for my situation.

Here are the configs to my client and server, respectively.

ssh_config

#	$OpenBSD: ssh_config,v 1.28 2013/09/16 11:35:43 sthen Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
#   ForwardAgent no
ForwardX11 no
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h

sshd_config

#   $OpenBSD: sshd_config,v 1.97 2015/08/06 14:53:21 deraadt Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
#Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Ciphers and keying
#RekeyLimit default none

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#RSAAuthentication yes
#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile  .ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# 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

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost no
#PermitTTY yes
PrintMotd no # pam does that
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
UsePrivilegeSeparation sandbox      # Default for new installations.
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem   sftp    /usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server

Any help is appreciated!

Offline

#2 2016-02-28 22:48:41

null
Member
Registered: 2009-05-06
Posts: 398

Re: OpenSSH Connection Reset by [IP ADDR]

samuelrey wrote:

...
But I am not exactly sure what to look for. I did notice

debug1: key_load_public: No such file or directory

and

debug3: no such identity: /home/psycho/.ssh/id_rsa: No such file or directory

but don't know what to make of it.

...

That's just OpenSSH looking for a private key to connect with, because you didn't specify any in your command. After it couldn't find any in those default paths it'll just prompt you for a password. The lines

debug1: Next authentication method: password
psycho@10.0.0.42's password:
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).

are the important ones. Everything worked fine.

Can you eliminate a buggy internet connection? That's what it sounds like.


Edit: And the sshd log from your arch box would probably be much more helpfull.

Last edited by null (2016-02-28 22:55:03)

Offline

#3 2016-02-29 07:35:17

samuelrey
Member
Registered: 2015-10-06
Posts: 10

Re: OpenSSH Connection Reset by [IP ADDR]

null wrote:

Can you eliminate a buggy internet connection? That's what it sounds like.

I would like to think so, given that they are on the same LAN.

Couldn't find logs, so I ran

$ journalctl -u sshd | tail -100

with my latest start.

Feb 28 23:29:06 constance systemd[1]: Started OpenSSH Daemon.
Feb 28 23:29:06 constance sshd[8342]: Server listening on 0.0.0.0 port 22.
Feb 28 23:29:06 constance sshd[8342]: Server listening on :: port 22.
Feb 28 23:29:47 constance sshd[8748]: Accepted password for psycho from 10.0.0.49 port 52990 ssh2
Feb 28 23:29:47 constance sshd[8748]: pam_unix(sshd:session): session opened for user psycho by (uid=0)

It does appear that everything is working fine, though.

Offline

#4 2016-02-29 09:57:45

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: OpenSSH Connection Reset by [IP ADDR]

Moving to "Networking, Server and Protection".

Offline

#5 2016-02-29 22:58:44

null
Member
Registered: 2009-05-06
Posts: 398

Re: OpenSSH Connection Reset by [IP ADDR]

samuelrey wrote:
null wrote:

Can you eliminate a buggy internet connection? That's what it sounds like.

I would like to think so, given that they are on the same LAN.

That's where most of the bugs are.. Misconfigured routers, IP address conflicts, broken hardware and so on..

samuelrey wrote:

Couldn't find logs, so I ran

$ journalctl -u sshd | tail -100

with my latest start.

Feb 28 23:29:06 constance systemd[1]: Started OpenSSH Daemon.
Feb 28 23:29:06 constance sshd[8342]: Server listening on 0.0.0.0 port 22.
Feb 28 23:29:06 constance sshd[8342]: Server listening on :: port 22.
Feb 28 23:29:47 constance sshd[8748]: Accepted password for psycho from 10.0.0.49 port 52990 ssh2
Feb 28 23:29:47 constance sshd[8748]: pam_unix(sshd:session): session opened for user psycho by (uid=0)

It does appear that everything is working fine, though.

It seems like you don't have persistent journal logging activated[1] and also that this log does't contain the parts, where your connection fails. Even if you're disconnecting normally from your arch box it should log something like this:

Feb 28 23:29:47 constance sshd[8748]: pam_unix(sshd:session): session opened for user psycho by (uid=0)
Feb 28 23:29:47 constance sshd[662]: Connection closed by 10.0.0.49[preauth]

Post the same command after you experienced your problem again.



[1] https://wiki.archlinux.org/index.php/Systemd#Journal

Offline

Board footer

Powered by FluxBB