How do i change the SSH Port?

How do I change my SSH port? (linux)

In order to help minimize the number of port scans/brute forcing on your SSH service, its a good idea to change the SSH port to something other than 22.

You can simply :-

  • log into your VPS via SSH (shell)
  • Open your SSH configuration file using "nano /etc/ssh/sshd_config"
  • Change "#Port 22" to "Port XXXX" replacing your chosen port in there obviously. Save the file.

NOTE: Before this next step, ensure you Disable any Firewall you are using, or update it to include your new port, or you will lock yourself out of your VPS.

  • Now run "service sshd restart"
NOTE: You may need to install nano (text editor) or use your default text editor if nano is not installed"
  • 47 Users Found This Useful
Was this answer helpful?

Related Articles

Zombie Process Slayer - Script to kill defunct processes

Here is a small script that you can use to show you which processes are zombies and which user is...

How can i cancel my dedicated server?

How Do I Cancel My Dedicated Server & Account? To cancel your account you need to login to your...

How can I move a xen LVM based virtual machine from one server to another?

For those running servers with no back-end SAN, the following instructions detail the steps...

How can i show my cpu info (linux)?

How can i show my cpu info? Log in to your server via SSH then typ;e the following command...

How can i sync hardware clock

How can i sync the hardware clock in cent os?   First make sure your clock is accurate you can...