Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Network Services»SSH»How to Change SSH Port in Linux

    How to Change SSH Port in Linux

    RahulBy RahulMay 19, 20212 Mins ReadUpdated:April 22, 2022

    SSH (Secure Shell) is the most popular protocol for connecting remote Linux systems. Changing the SSH port will provide you with an extra layer of security. The new port will be a little harder to identify for hackers.

    How to Change SSH Port in Linux

    Most Linux distributions use OpenSSH as the default application as an SSH server. It encrypts all traffic throughout the route and provides a higher level of security. This article describes you to change the OpenSSH server port on a Linux system.

    Change SSH Port in Linux

    Changing SSH port is a straightforward process in Linux systems. Any system can use the port range 1 to 65535, For TCP, port number 0 is reserved and cannot be used. The default SSH service listens on port 22. Just this port with some other ports.

    To change SSH port in Linux, edit OpenSSH configuration file:

    sudo nano /etc/ssh/sshd_config 
    
    • Change from – Search for the below line, default it can be commented.
      #Port 22
      
    • Change to – Remove ‘#’ symbol from prefix to uncomment above line, Then replace 22 with a non-standard port like:
      Port 2232
      

    To save and close file press CTRL + X keys, then press ‘y’ and hit enter button.

    Now, restart the SSH daemon to apply changes.

    sudo systemctl restart ssh 
    

    That’s it. The SSH service is now running on an updated port as configured above.

    Connect SSH to New Port

    The SSH service is listening on a non-standard port. So, you have to provide a port number while connecting the server using the ssh client.

    Use the following command from the client machine to connect the remote server to a new port.

    ssh -p 2232 [email protected] 
    

    The rsync user follow these instructions to connect remote system on a different port.

    Conclusion

    This tutorial helped you to secure your Linux server by changing the SSH port to a non-standard port. Once the SSH port is changed, you must update the firewall rules to secure the new port.

    OpenSSH port SSH
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Remove Package from Laravel (Composer)
    Next Article How to Enable Debug Mode in Laravel

    Related Posts

    How to Create SFTP User in Ubuntu 22.04 (No Shell Access)

    Updated:June 14, 20224 Mins Read

    (Resolved) userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms

    Updated:May 10, 20221 Min Read

    Adding a New SSH Key in GitHub

    Updated:April 1, 20223 Mins Read

    How to Scan Open Ports with Nmap

    5 Mins Read

    How to Create SFTP Only User in Debian 11

    Updated:September 26, 20214 Mins Read

    How to Disable Strict Host Key Checking in SSH

    Updated:September 25, 20212 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.