CentOS, Security

How to Change the Default ssh Port Number in Linux

By default, ssh listen to port 22 for connections. Attackers will use a port scanner software (such as nmap) to scans for an open port. Normally these port scanners do not scan higher ports.

To change the default port, you will need to open the configuration file using your favorite text editor (vi,nano) located in


and look for a line that says:

Port 22

Change the port number to something like

Port 10000 #use your own

and restart the ssh server by typing

/etc/init.d/ssh restart

*note: you may need to be root in order to change and restart the ssh service.

By changing the default port, you now can connect to the server by typing the following command:

ssh .p username@server


2 thoughts on “How to Change the Default ssh Port Number in Linux”

  1. Oh my goodness! an amazing article dude. Thank you Nevertheless I am experiencing concern with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting identical rss drawback? Anybody who knows kindly respond. Thnkx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s