1 Changing the SSH port
By default SSH runs on port 22. If someone tries to access your server via SSH they will probably use port 22. Changing this port means that the SSH server does not listen to this port and the service isn't available on it anymore.
To change your SSH port, use the following commands.
- Depending on your Linux distribution, there is a configuration file for the SSH server. To find out where the file exists, run the following command.
ls /etc/ssh/ | grep config
- Open the configuration file with Nano.
- Search for the "Port" option and change the value specified there to a new port.
Note! You should never use a port that is already used by another process.
- Use the service ssh restart command to restart the SSH service.