Enable multiple ssh ports Linux


By default only one port (port number 22) will be enabled as ssh/scp port in Linux

To enable multiple ssh ports we need to tweak /etc/ssh/sshd_config file.

Open /etc/ssh/sshd_config with any editor and search for line Port 22. Below this line add a new port which you want to use.

Example: I would like to use 12345 as another ssh port, add it as shown below.

Port 22

Port 12345

Save and exit from /etc/ssh/sshd_config file.

Restart sshd service with following command:

$ service sshd restart

After restarting sshd service test try to login/ssh with new port 12345, it should work.

You can also check list of ports opened for ssh using following command where you can see port 22 and 12345 in output:

$ netstat -anp | grep ssh


tcp 0 0 :::22 :::* LISTEN 3075/sshd
tcp 0 0 :::12345 :::* LISTEN 3075/sshd


2 comments on “Enable multiple ssh ports Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s