Help with sshd on Linux mint

Good day to whomever maybe reading this. I’m having difficulty on what I may have done wrong or what I haven’t fully configured properly.

I have installed a clean version of Linux mint on a beremetal pc. I updated my package’s and did an upgrade as well. I installed sshd server and client, enabled ufw and set it to accept ssh on 22 default port. That’s it absolutely nothing else, nothing else was installed.

I attempted to ssh from my Windows machine using powershell, I successfully logged in. From this point onwards I am only being disconnected from the ssh sesson. My maximum time being connected to the machine is 12 seconds. I’m unable to maintain a stable connection for over this time period.

I keep getting and error msg stating " client_loop: send disconnect: connection reset"

I’ve read forums, watched YouTube vids about changing the client alive interval and other options but the issue is stills remains.

The reason for using mint is I want to learn Linux aswell as docker. Since I’m still new I feel more comfortable having a gui to help me out in certain situations as to just having to use the terminal only. When I become more proficient with terminal I’ll gradually move to it full time.

If anyone can give assistance that will become very much appreciated

Once logged into the remote shell, please type the following to get the current length of the timeout.

echo $TMOUT

this will return a value in seconds that if you do not enter input into the session (I.E typing) it will close the session.

So if it comes back with 12 then for some reason your timeout would be set to 12 seconds.

You would override this value but changing the variable and making it persistent into your .bashrc file.

I.E set to 5 minutes

echo 'TMOUT=300' | tee -a ~/.bashrc

And then to update your current shell

source ~/.bashrc

Or log out and log back in.

1 Like

Ok. I typed “echo $TMOUT” and gotta nothing. Usually when entering a command the following information will be on the next line. I got a blank line with no text.

if the variable is unset then that means there is no default timeout that would kill your session.

That’s good!

But this means that something else is causing the session to close.

Session files are created and placed on the filesystem. I believe by the systemd-logind service manages these in addition to sshd.

To increase the ability for us to help you troubleshoot, please close your session and then append the verbose flag so that we might glean more info.

ssh -v user@host

Save that output once your session was killed and post it in this thread please.

1 Like

I’m trying to post the results from using the verbose command but I’m getting multiple errors from this one website stating : “I cannot post links”, “new user’s can not post more than 5 links” and other link to related errors. I’ll see how I can get it posted

type or PS C:\WINDOWS\system32> ssh -v [email protected]
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Connecting to 192.168.20.66 [192.168.20.66] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\itadmin/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.9p1 Ubuntu-3ubuntu0.1
debug1: match: OpenSSH_8.9p1 Ubuntu-3ubuntu0.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.20.66:22 as 'aaron'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:QUZS+BF2EwS1a9antfJHhauorLWh3CmxCISnKCC1Qq8
debug1: Host '192.168.20.66' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\itadmin/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: kex_input_ext_info: [email protected] (unrecognised)
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_xmss
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to 192.168.20.66 ([192.168.20.66]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
debug1: client_input_global_request: rtype [email protected] want_reply 0
Last login: Wed Jul 12 15:28:08 2023 from 192.168.1.167
aaron@docker:~$ client_loop: send disconnect: Connection reset
PS C:\WINDOWS\system32> code here
type or PS C:\WINDOWS\system32> ssh -v [email protected]
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Connecting to 192.168.20.66 [192.168.20.66] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\itadmin/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\itadmin/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.9p1 Ubuntu-3ubuntu0.1
debug1: match: OpenSSH_8.9p1 Ubuntu-3ubuntu0.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.20.66:22 as 'aaron'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:QUZS+BF2EwS1a9antfJHhauorLWh3CmxCISnKCC1Qq8
debug1: Host '192.168.20.66' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\itadmin/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\itadmin/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: kex_input_ext_info: [email protected] (unrecognised)
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\itadmin/.ssh/id_xmss
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to 192.168.20.66 ([192.168.20.66]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
debug1: client_input_global_request: rtype [email protected] want_reply 0
Last login: Wed Jul 12 15:28:08 2023 from 192.168.1.167
aaron@docker:~$ client_loop: send disconnect: Connection reset
PS C:\WINDOWS\system32> code here

hmm not much to be honest. It just shows a disconnect like you said.

Are ssh’ing to a different host entirely or is this ssh’ing to a docker container running on your local machine?

Different host entirely. That’s what I’m saying. It’s a brand new install of mint, nothing was installed besides the sshd server and client. I was learning on a debian install before and didn’t have this issue. I’ll just start over and reinstall debian.

Not losing much as it didn’t have anything configured on it. Thanks for the help though.

1 Like

You’re welcome, sorry you had such a confusing time right out of the gate.

I think I figured out what may be causing the issue. The Linux mint PC has a subnet of /16 while my main PC which I’m using to SSH is on a /24.

Reason being I connected to the companies network over our VPN service which assigns user’s a /16 address and subnet and I have no issues with the host. I’ve been connected for over 2 hrs now.

I asked my coworker whose still at the company to set up his subnet tour /16 because he as well was being disconnected after the same 12 second timeout period. Now is connection issues stable and hasn’t had any disconnects.

Also changed the subnet on the host machine to /24 and that also worked but will leave it on the old /16 address.

Still… thank you for the assistance earlier on today.

2 Likes