PROBLEM:  Dialing into my dedicated Ubuntu server the connection drops if I am not active for a relatively short time of about 2 minutes.  

SOLUTION:  IMPLEMENTED:  Added the ServerAliveCountMax ServerAliveInterval entries to the client side ssh config file.

 

Solution 

  • Client_loop: send disconnect: Broken pipe – Critical find 
  • ssh -o TCPKeepAlive=yes -o ServerAliveCountMax=20 -o ServerAliveInterval=15 root@IP_address 
  • This appears to imply the server has not been restarted when the restart and / or reload commands were issued. 
  • Restart server and see if these statments are still required.  >  Updated and rebooted.  Still did not hold the connection longer than ~2 minutes.
  • Checked server and client side config file and I do not see ServerAliveCountMax   ServerAliveInterval in either file
  • Which side do the settings:  ServerAliveCountMax   ServerAliveInterval entries belong in?  Is it safe to assume in the SSH_Config files?
  • Linux and VMWare: SSH avoid disconnection inactivity ( original in Spanish – link includes translation )  – see snippet below:  my guess appears to have been correct – add the entries to client side says this reference

From the SSH client side:

If the client is Linux:   Edit the configuration file:  ssh_config

  • At user level: ~/.ssh/config
  • or for all users: /etc/ssh/ssh_config

Add:

Host *
ServerAliveInterval XX
ServerAliveCountMax YY

 

Differences in names between server and client SSH configuration file names

  • etc/ssh/sshd_config  is folder name on server
  • etc/ssh/ssh_config on client

 

Research Links

 

Steps

  1. Using vi  >  Set the values to:    ClientAliveInterval  1200   ClientAliveCountMax 3     
  2. Saved using :wq 
  3. Attempted to restart SSH using specified command:   systemctl reload sshd
  4. comes back with   sshd.service not found
  5. tried to restart using  systemctl reload ssh  – appeared to execute. Still timed out after this.


 

SSH Notes:

  • What is sshd in Ubuntu?  sshd (OpenSSH Daemon) is the daemon program for ssh.     

vi editor notes

 

:wq

To save a file, you must first be in Command mode. Press Esc to enter Command mode, and then type :wq to write and quit the file. The other, quicker option is to use the keyboard shortcut ZZ to write and quit.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Categories:

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *