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

  • winkibili
    replied


    You can secure an ssh key with a password*, but that's not the same thing as password authentication. Therefore the answer to your question is because "both" becomes "either", which puts you right back to square one with brute force attempts.







    Last edited by winkibili; 09-05-22, 01:23 PM.

    Leave a comment:


  • KelvinSmith
    replied
    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.

    Leave a comment:


  • 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.
Working...
X