It is without a doubt the daily bread of those who administer networks. Because we need to control, remotely manage other computers and / or servers, and using SSH we can do this … we can do as much as our imagination allows us ?

It happens that SSH uses port 22 by default, so all hacking attempts to SSH will always default to port 22. A basic security measure is simply NOT to use SSH in this port, we will configure for example SSH to listen ( work) on port 9122.

Achieving this is extremely simple.

1. We must obviously have SSH installed on our server (openssh-server package)

2. Let’s edit the file


For this in a terminal (as root) we put:


nano /etc/ssh/sshd_config

There between the first lines we see one that says:


Port 22

We changed the 22 for another number, which would be the new port, in this example we said that we would use 9122, so the line would be:


Port 9122

3. Now we restart SSH to read the new configuration:


/etc/init.d/ssh restart

This in case they use. If they use it would be:


/etc/rc.d/ssh restart

And that’s it, they’ll have SSH by another port (9122 according to the example we’ve used here)

Well I think there’s nothing more to add.

Any questions you have, let me know ?


PD: Remember, all this has to do with administrative privileges … either as root, or using sudo.


Categories: SoftwareTutoriales