PDA

View Full Version : Internet Changing your SSH port



phauk
03-13-2010, 01:25 PM
Assuming you have already logged into the server, run the following command to locate your SSHd config file:

locate sshd_config

That command will give you the location of your SSHd config file, usually /etc/ssh/sshd_config.

Now open up that config file using your favorite text editor, we'll use nano.

nano /etc/ssh/sshd_config

The bit of information we're interested in looks like this:

#port 22

Change that to:

port [port_number]

Replace [port_number] with a random 4 digit number, one you will not forget (ie. port 999).

Save the file, exit the editor, and run this command:

/etc/init.d/ssh restart

If that command gives you an error, try:

/etc/init.d/sshd restart

Assuming you edited the sshd_config file properly, the SSH daemon service should now restart, and you can SSH into your server with your new port.

This will immensely reduces hackers being able to penetrate your box and don't lose your servers full potential.

You can see the last people to log into your server, and when by typing: lastlog

Enjoy. :wave:

lightshow
03-15-2010, 02:54 AM
That's a good tip. It would help fight against all those automated port scanners. Now, just to check to make sure

permitrootlogin=no

lol