Partner links

Solution to freezing SSH sessions on Ubuntu 16.10

openSSH logo

I manage several cloud servers via SSH, but after upgrading my main desktop to Ubuntu 16.10 (from Ubuntu 16.04), I observed that those (SSH) sessions would freeze just after a few seconds of inactivity, even right in the middle of editing a file.

I figured that the servers were not the problem, because that has never happened before, and the fact that it didn’t matter what Linux distribution the remote server was running. So there must have been a change in the default client configuration that was causing the problem.

Startpage to the rescue, which led me to this article. The fix offered by the author in that article is for Mac OS X, but it works just as well on any Linux distribution, with one less command to execute.

The fix is to set values for ServerAliveCountMax and ServerAliveInterval for the SSH client, which you do in a configuration file in the .ssh directory of your home folder. So create and open the file using the following command:

# Change to the .ssh directory under your home folder

cd ~/.ssh

# Create and open a config file

sudo nano config

#

Then add the variables and their values in the following code block to it.

# Sets number of server alive messages which may be sent without ssh receiving any messages back from the server.

ServerAliveCountMax 3

# Timeout interval (in seconds) after which if no data has been received from the server, ssh will send a message 
# through the encrypted channel to request a response from the server.

ServerAliveInterval 5

Close the file. That should solve your freezing SSH session issues. No need to adjust the file’s permissions, because the default is good enough. For more information about those and other variables, consult the manual page using man ssh_config.

openSSH logo

Share:

Facebook
Twitter
Pinterest
LinkedIn

Partner links

Newsletter: Subscribe for updates

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Get the latest

On social media

Security distros

Hacker
Linux distros for hacking and pentesting

Crypto mining OS

Bitcoin
Distros for mining bitcoin and other cryptocurrencies

Crypto hardware

MSI GeForce GTX 1070
Installing Nvidia GTX 1070 GPU drivers on Ubuntu

Disk guide

LVM
Beginner's guide to disks & disk partitions in Linux

Bash guide

Bash shell terminal
How to set the PATH variable in Bash
Categories
Archives
0
Hya, what do you think? Please comment.x
()
x