System Administration

Tuesday, 15 November 2016 23:50

How to disable SSH timeout?

Written by

SSH clients will automatically be disconnected from the server and prompt the below message after being idle or inactive for a while.

This is due to the SSH servers' configuration (often by default) to avoid hanging sessions and free up resources. These are the related options in the SSH server configuration;

TCPKeepAlive

Whether or not to send TCP “alive” message to the connecting clients to test for connection issues. Defaults to yes.

ClientAliveInterval

A timeout interval to send encrypted alive message to clients if no data has been received from connection. Defaults to 0 (not sending any message).

ClientAliveCountMax

Number of times to send the encrypted alive message before disconnecting clients if no response are received. Defaults to 3.

If you have administrative access to the SSH servers, you can change the options so that you will not easily be disconnected. Edit the SSH server configuration file (normally in /etc/ssh/sshd_config for Unix based operating systems) and set the related options as the followings (uncomment or add if necessary);

TCPKeepAlive no 

ClientAliveInterval 30

ClientAliveCountMax 100

What it basically means is that the server will not send the TCP alive packet to check if the client's connection is working, yet will still send the encrypted alive message every 30 seconds but will only disconnect after 24 hours of inactivity. Be sure to restart the SSH service after the reconfiguration. The following command would work for most Unix based servers;

sudo service sshd restart

If you don't have administrative access to the server, you can configure the SSH client to send the alive message to the server instead. The key here is the ServerAliveInterval option for the SSH client.

You can do this by updating /etc/ssh/ssh_config (applying the setting to every user in the system) or in ~/.ssh/config (single user). Set the following option to have the client send the alive packet every 30 seconds to the server;

 

ServerAliveInterval 30

Tuesday, 08 November 2016 22:38

High CPU load on Centos with process [sync_supers]

Written by

Killing process will not get you far. I would rather recommend stop so you can inspect what is going on. By running

kill -TERM 17757

You will kill the process (notice PID column value for sync_supers may have changed since. Instead of killing immediately try doing

kill -STOP 17757

Then inspect procfs for this process ID

ls -al /proc/17757/

It will be informative to see cwd line; it says from which dir this process was started Examine also

cat /proc/17757/cmdline

To see how process was started

And also possibly interesting info in

ls -la /proc/17757/fd

Which will tell you if any files are opened by process.

If you want to interactively snoop on what process is doing, you can attach to it with system call tracer  strace like this

strace -p 17757

However if process is stopped, you would not see much since it's stopped, so this may be something to consider before doing anything to the process.

Page 3 of 3