SSH MaxSessions Configuration

SSH is a popular and effective way to connect to remote Linux machines in the command line. In most Linux distributions, SSH functionality is available from OpenSSH utilities.

In this tutorial, we will take a look at the SSH configuration administered by the sshd_config file. Modifying the sshd_config file permits us to modify how SSH connections play out on the server.

Getting Started

Before we proceed, ensure you have:

  • SSH installed and running on your server
  • Root or a sudo account.

With the above requirements met, we can proceed.

The OpenSSH Daemon Configuration

The ssh daemon (sshd) reads the configuration file located in /etc/ssh/sshd_config. However, you can override the default configuration by specifying the -f <filename> in the command line when starting the SSH daemon.

Entries in the configuration file are in the form of key-argument pairs with one entry per line. If a line in the configuration file begins with a #, SSH treats the entry as a comment and ignores it.

Keywords in the sshd configuration files and case-insensitive while the arguments are case-sensitive.

Changing SSH Daemon MaxSessions Settings

The MaxSessiosn setting defines the maximum number of open sessions per connection. A more precise way to think about this setting is, it allows you to control the number of SSH sessions sent over a single TCP connection. The default value is 10. The MaxSessions setting is very straightforward. The lower the number, the fewer number of connections and vice versa.

NOTE: Setting the value to 0 disables all sessions, including login, shell, and subsystem. To disable shell multiplexing, you can set the value to 1.

Edit the sshd_config file to change the MaxSessions to your desired value.

sudo vim /etc/ssh/sshd_config

Uncomment and change the value.

In Closing

That is all for MaxSessions in SSH.

NOTE: Before changing the setting, ensure you do not need more sessions than allowed in the config file.

Thank you for reading, and Happy SSH time!



from Linux Hint https://ift.tt/3yfBVcU

Post a Comment

0 Comments