Announcement

Collapse
No announcement yet.

How to Secure CentOS SSH connection by changing the default port?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Secure CentOS SSH connection by changing the default port?

    Hi,
    How to Secure CentOS SSH connection by changing the default port?
    Any help greatly appreciated.

  • #2
    Step 1: Open sshd_config file using any text editor installed on your server

    $ nano /etc/ssh/sshd_config
    Step 2: After opening the config file, change the SSH port from 22 to any random number such as 6340

    $ Port 6340
    Step 3: After defining the new port, save the file and restart the SSH service

    $ service sshd restart
    Step 4: Now, change the SSH port in iptables rules

    $ nano /etc/sysconfig/iptables
    Here, search port 22 and change it to 6340

    Step 5: After changing the port in iptables, save the file and restart iptables service

    $ service iptables restart
    Now you are done with all simple settings.

    Note: If you are running any Firewall or Anti-virus on your server then you need to allow the new SSH port in its configuration as well.

    Comment

    Working...
    X