Close Menu
Technoracle
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    TechnoracleTechnoracle
    • Home
    • AWS
      • EC2
      • Lightsail
      • RDS
      • S3
    • Ubuntu
      • Ubuntu 20.04
      • Ubuntu 22.04
    • AI Tools
    • Web Hosting
    • WordPress
    • Tech News
    Technoracle
    Home - Ubuntu - How to Change SSH Port in Linux Easily ( Only 2 Commands)
    Ubuntu

    How to Change SSH Port in Linux Easily ( Only 2 Commands)

    Rajesh ShivamBy Rajesh ShivamJune 5, 2021Updated:June 11, 2023No Comments2 Mins Read
    Change SSH Port in Linux

    By default, most of the web server’s SSH port is 22 such as AWS, Digital Ocean. By changing the SSH port of any Linux server, you can tighten the security of the server. In this, tutorial, I am going to change SSH port in Linux easily.

    Change SSH Port in Linux Easily

    You can easily change SSH port in Linux systems. You can use ports ranging from 0 to 65535. The port number 0 is reserved and cannot be used. The default SSH service listen on port 22. Just this port with some other ports.

    To change and update SSH port, edit OpenSSH configuration file

    $ sudo vi /etc/ssh/sshd_config

    In the configuration file, search for port 22 . When you find port 22, uncomment the port and replace it with some other nonstandard port (let’s take 2220.) Now save the config file.

    Search for
    Port 22
    
    Replace with
    Port 2220

    Now, restart the SSH daemon to apply changes.

    $ sudo systemctl restart ssh 

    Awesome, your ssh server login port has been changed successfully.

    Access the Server with New SSH Port

    As the SSH daemon is running under non-standard port, you have to mention port number with the command-

    $ ssh -p 2220 user@serverIP

    Conclusion

    In this short tutorial, you have learned to change SSH port in linux. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle

    linux security ubuntu tips
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit
    Previous ArticleHow to Attach Static IP to AWS Lightsail Instance Easily
    Next Article How to Install Zabbix Agent on Ubuntu 20.04 Easily
    Rajesh Shivam
    • LinkedIn

    Rajesh Shivam is a seasoned professional with expertise in AWS and Linux System Administration. With over 10 years of freelancing experience, he brings a wealth of knowledge to the table. Rajesh has a strong passion for technology and stays connected with the latest happenings in the field. His dedication and expertise make him a trusted resource for all things tech-related.

    Related Posts

    linux commands every user should know in 2025
    Ubuntu 24.04

    25 Must-Know Linux Commands Every User Should Master in 2025

    Read More
    TeamViewer and Ubuntu logos on gradient background – banner for how to install TeamViewer on Ubuntu 24.04 tutorial
    Ubuntu 24.04

    How to Install TeamViewer on Ubuntu 24.04 [Fast & Easy Steps]

    Read More
    Troubleshooting ‘Permission Denied (publickey)’ SSH error on a Linux server using secure terminal access
    Ubuntu

    Fix ‘Permission Denied (publickey)’ SSH Error on Linux [Step-by-Step Guide]

    Read More
    Add A Comment
    Leave A Reply Cancel Reply

    linux commands every user should know in 2025

    25 Must-Know Linux Commands Every User Should Master in 2025

    April 10, 2025
    TeamViewer and Ubuntu logos on gradient background – banner for how to install TeamViewer on Ubuntu 24.04 tutorial

    How to Install TeamViewer on Ubuntu 24.04 [Fast & Easy Steps]

    April 10, 2025
    Troubleshooting ‘Permission Denied (publickey)’ SSH error on a Linux server using secure terminal access

    Fix ‘Permission Denied (publickey)’ SSH Error on Linux [Step-by-Step Guide]

    April 8, 2025
    Blog banner showing Ubuntu logo, coding laptop, and icons for VS Code, Docker, and Git with the title 'Perfect Dev Setup in Ubuntu 24.04 – Step-by-step guide for developers' on a dark tech-themed background.

    How to Set Up the Perfect Development Environment on Ubuntu 24.04

    April 8, 2025

    Subscribe to Blog

    Enter your email address to subscribe to
    this blog and receive notifications of new posts by email.

    Facebook X (Twitter) Instagram Pinterest
    • Sitemap
    • Privacy Policy
    • Disclaimer
    • Term of Services
    © 2025 Technoracle

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

    Click to Copy