Changing the SSH Port for Your Linux Server
You can change the default SSH port for your Linux server as an added security measure.
Make sure the new SSH port does not conflict with any known or blocked ports.
To Change the SSH Port for Your Linux Server
- Log in to your server using SSH.
- Once you're logged in, type su - root.
- In the password field, type the same password you used to connect to your server. (You can also use the current root password if this has been changed.)
- At the command prompt, type:
vi /etc/ssh/sshd_config
- Locate the following line:
# Port 22
- Remove # and change 22 to your desired port number.
- Restart the sshd service by typing:
service sshd restart