How To Change Default SSH Port?

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • ryan
    Member
    • Jun 2008
    • 96

    How To Change Default SSH Port?

    The default SSH port is set to 22. You can update your linux server to listen to some other port, to minimize the RDP attacks.

    Follow the instructions below to change the default port:

    1) Login to your Linux server with root user through SSH. It is always good to have backup of the file before you make any changes to configuration files so without fail create backup of ssh config file /etc/ssh/sshd_config

    cp /etc/ssh/sshd_config /etc/ssh/sshd_config_backup

    2) Open the file with any text editor. I have used vim editor.

    vim /etc/ssh/sshd_config

    It will contain the line as Port 22 as mentioned in below image:


    If the line is commented with character # then first remove that character so that server can identify to execute it. Now, mention your desired port as Port 2121(you can use other random port ranging between 1024-65535)

    3) Save the file & restart the sshd service

    4) service sshd restart

    Generally, it is recommended to reboot your Linux VPS after changing the default port.

    on next ssh access, you will require to use the port like ssh root@127.0.0.1:2121

    [Note :- you must open that randomly set port on your firewall]


    Accuwebhosting.com
    Last edited by admin; 07-27-2015, 09:27 AM.
Working...
X