+ Reply to Thread
Results 1 to 4 of 4

Thread: How to change the SSH port of Linux

  1. #1
    HWHT Starter LionTechservers is on a distinguished road
    Join Date
    Apr 2018

    How to change the SSH port of Linux

    How to change the SSH port of Linux?

    Welcome to exchange!!!!!

  2. #2
    HWHT Starter dineshsma is on a distinguished road
    Join Date
    Jun 2018
    Its simple. Log into through SSH to the server using root login. The edit the file /etc/ssh/sshd_config using any text editor of your choice like vi, nano, pico or emacs.

    Then search:
    #Port 22
    Replace with:
    Port 2020
    Once you saved and restarted sshd service. It will listen on port 2020.
    Make sure you open the new SSH port in firewall before change the SSh configuration otherwise you will get locked.
    TRY OUT FREE!!! -- Expert in Server Management, Server Hardening & Server Optimization.
    24x7 Whitelabel Outsourced Support - Helpdesk, Livechat, Messenger.
    IM (skype): servermanagementadmins Email: sales[@]servermanagementadmins[.]com

  3. #3
    Hosting Guru hostechsupport is on a distinguished road
    Join Date
    Sep 2006
    Just edit the file /etc/ssh/sshd_config using any text editor remove the hash before port and replace 22 with your desired port save the file.
    Add the new port in the firewall and restart sshd service finally you can check through netstat the new port must be listening on the new port.
    Server Management, Cloud Server Management
    Dedicated & VPS Server Management

    24x7 Remote Technical Support

  4. #4
    Hosting Guru ClayPage is on a distinguished road
    Join Date
    Oct 2017
    Old Tappan

    Log in to your VPS server using SSH, using Terminal.

    Once logged in, run the following command:

    vi /etc/ssh/sshd_config
    The SSH configuration file will open. Locate the following line:

    # Port 22
    Type i to enter the vi text editorís Insert mode. Delete the ď#Ē and change the port number to an alternative.
    Press Escape to return to viís Command mode.

    Type :wq! to save the file and quit the vi text editor.

    Now run the following command to restart the SSH service on your server with the new port number.

    service sshd restart

+ Reply to Thread

Similar Threads

  1. how to change nameserver?
    By plachira in forum DNS
    Replies: 5
    Last Post: 10-25-2018, 06:05 PM
  2. change the default SSH port 22
    By thewebhostingdir in forum Technical and Security Tutorials
    Replies: 4
    Last Post: 07-18-2018, 08:54 PM
  3. Should I change this page?
    By Just199-Dave in forum SEO Tools and Software Utilities
    Replies: 0
    Last Post: 10-02-2007, 05:05 PM
  4. HTTP server (port 80) is down?
    By xammy in forum HCC-Announcements, HCC-Feedback, HCC Questions
    Replies: 2
    Last Post: 07-06-2006, 07:43 AM
  5. Allow SMTP through port 26
    By incript_services in forum Web Hosting Tutorials
    Replies: 3
    Last Post: 09-19-2005, 05:24 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts