by HostMonster Reviews

How to change the default SSH Port in Debian

Published: Wednesday, 11 June 2014

The default port for Secure Shell(SSH) is 22. An additional security step for a server that allows connectons via SSH is to change its default SSH port.

To start with, here is a short tutorial on how to install SSH and VNC server for remote desktop access in Debian.

1) Open SSHD configuration file(sshd_config): nano /etc/ssh/sshd_config

Look for a line with title: #What ports, IPs and Protocols we listen for:

"Port 22" can be changed to another port# which you could easily remember. Make sure its not a well-known port such as "Port 80". You could also list several Port #s as follows:

Port 22
Port 2299
Port 2277
Port 9922
Port 2929

thus, SSH connections will be accepted on any of the above......just in case one is blocked for extreme reasons.

2) If your server has multiple interfaces, for additional security purposes, it is a good idea to allow SSH-connections through only one-interface. Restrict SSH-connections to specific interfaces in the lines that read:

# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::

3) Restart the SSH daemon to apply any changes you have made:

service ssh restart

After any edits you might have made, the following commands can be used to start, stop or verify OpenSSH server's status:

- service ssh stop
- service ssh start
- service ssh restart
- service ssh status

Happy SSH'ing

Add comment

Security code