sudo apt-get install openssh-server openssh-client
To change now the SSH server port number, follow these instructions:
- Via the command line, edit this file:
sudo gedit /etc/ssh/sshd_config
- Search for Port 22 and make sure it is uncommented, then set your own port number:
- To run your SSH server on multiple port numbers, add each port in a new line as follows:
- Press now CTRL+Q and save your file, then restart your SSH server with this command so that your changes take effect:
sudo /etc/init.d/ssh restart
sudo service ssh restart
- You can now test your ports by running this command:
ssh -p PORT_NUMBER localhost
Here is an example:
ssh -p 22 localhost
If you are required to submit a password, then your SSH server is listening to this selected port.
Note: this tip is also workable for Ubuntu 11.04/10.10/10.04.