How to Modify SSH to Use a Port Other than 22

 

A simple, but very effective, step you can take to enhance your server's security is to update the port SSH uses to a port other than 22 (the default). To do this, login to your VPS as root and follow these steps:

 

1. Open the SSH config file with the vi editor:

# vi /etc/ssh/sshd_config

 

2. Press the "A" key to enter editing mode. Look for this line, near the top of the file:

#Port 22

 

3. Uncomment the line (remove the pound symbol) and change the port value to any number of your choosing:

Port 6486

 

4. Press ESC, then type :wq (colon-w-q) and press enter to save and exit the file.

5. If you are running a firewall, ensure that the port you selected is open.

6. Restart the SSH service:

(CentOS) # service sshd restart

(Debian) # /etc/init.d/ssh restart

 

You will now access SSH through the new port, like this:

# ssh root@127.0.0.1 -p 6486

 

  • payment
  • 0 أعضاء وجدوا هذه المقالة مفيدة
هل كانت المقالة مفيدة ؟

مقالات مشابهة

How to close an open DNS resolver - Linux

Locate the BIND configuration file within the operating system. The BIND configuration file is...

How to Optimize MySQL with MySQLTuner

MySQLTuner is a script that will assess MySQL performance and recommend steps to maximize...

How to List All Open/Listening Ports

If you find yourself needing to check all open/listening ports that your server is using (a good...

How to Install ConfigServer Firewall (CSF)

ConfigServer Firewall, or CSF, is a common Linux security suite. Log in to your VPS as the root...

How to Check VPS Memory/RAM Usage with SSH

There are a few tools built-in to most Linux distros for gauging and fine-tuning your server's...

Powered by WHMCompleteSolution