SOLVED Losing SSH/SFTP connection after 90 seconds

tobiasbp

Patron
Joined
Dec 2, 2015
Messages
238
Update: This was network related. Not related to FreeNAS.

The problem was, that I was connecting to different NICS on the same FreeNAS machine. The NICS were in different network. When connection via SSH through a firewall, the connection was dropped after ~80 seconds by sshd on the FreeNAS. I have not investigated further. Problem was solved by connection to the FreeNAS NIC in the same network as the client.

Sorry for the noise,
Tobias

------------------------


Hello forum...

I want to backup some files from my own machine to my FreeNAS machine running Freenas 11..1-U4 (Not latest!).

I can connect with both ssh & sftp. The problem is, that the connection appears to be dropped by the server after around 80-90 seconds. The connection is dropped, even if I'm actively using the session (Moving around, listing etc.). The connection is NOT dropped if I log in as root. Only my own user is affected.

Here is the content of /usr/local/etc/sshd_config on the FreeNAS machine:
Code:
cat sshd_config

Subsystem       sftp    /usr/libexec/sftp-server -l ERROR -f AUTH
Protocol 2
UseDNS no
ChallengeResponseAuthentication no
ClientAliveCountMax 3
ClientAliveInterval 15
NoneEnabled yes
VersionAddendum none
Ciphers +aes128-cbc
Port 22
PermitRootLogin without-password
AllowTcpForwarding no
Compression no
PasswordAuthentication yes
PubkeyAuthentication yes
AllowUsers usera userb root


On the client, I have enabled ServerAliveInterval 10. It looks to me like the client tries to keep the connection alive, as seen here:
Code:
time ssh -vvv usera@backup.example.com

OpenSSH_7.2p2 Ubuntu-4ubuntu2.8, OpenSSL 1.0.2g  1 Mar 2016
...
...
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Last login: Tue Aug  6 17:18:47 2019 from ***
FreeBSD 11.1-STABLE (FreeNAS.amd64) #2 r321665+366f54a78b2(freenas/11.1-stable): Wed Mar 21 23:04:13 UTC 2018

    FreeNAS (c) 2009-2017, The FreeNAS Development Team
    All rights reserved.
    FreeNAS is released under the modified BSD license.

    For more information, documentation, help or support, go here:
     http://freenas.org
Welcome to *****
$ debug3: send packet: type 80
debug3: receive packet: type 82
debug3: send packet: type 80
debug3: receive packet: type 82
debug3: send packet: type 80
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype keepalive@openssh.com reply 1
debug3: send packet: type 100
debug3: send packet: type 80
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype keepalive@openssh.com reply 1
debug3: send packet: type 100
debug3: send packet: type 80
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype keepalive@openssh.com reply 1
debug3: send packet: type 100
debug3: send packet: type 80
debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)

Connection to backup.example.com closed by remote host.
Connection to backup.example.com closed.
Transferred: sent 4020, received 3828 bytes, in 80.3 seconds
Bytes per second: sent 50.1, received 47.7
debug1: Exit status -1

real    1m20.574s
user    0m0.032s
sys    0m0.012s


This is what I see in /var/log/auth.log:
Code:
Aug  6 17:19:02 *** sshd[99106]: Accepted publickey for *** from CLIENT_IP port 39336 ssh2: RSA SHA256:***
Aug  6 17:19:45 *** sshd[99277]: Connection closed by SERVER_IP port 56091 [preauth]
Aug  6 17:20:22 *** sshd[99120]: Timeout, client not responding.
Aug  6 17:22:42 *** sshd[265]: Connection closed by SERVER_IP port 56141 [preauth]



Any thoughts on why this is happening much appreciated.

Regards,
Tobias
 
Last edited:
Top