• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Monday, May 12, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Change the SSH Port on Ubuntu Server: A Step-by-Step Guide for Better Security

in Linux OS, Ubuntu
How to Change the SSH Port on Ubuntu Server

SSH (Secure Shell) is a protocol used for secure remote login to a server or computer. By default, SSH runs on port 22, but changing the port is a good security measure to prevent unauthorized access to your Ubuntu Server. In this blog post, we will go through the steps to change the SSH port on Ubuntu Server.

Step 1: Connect to your Ubuntu Server

First, connect to your Ubuntu Server via SSH using the current port (22). You can use any SSH client such as PuTTY or the built-in terminal on macOS or Linux.

Step 2: Edit the SSH configuration file

Next, you need to edit the SSH configuration file to change the default port. The SSH configuration file is located at /etc/ssh/sshd_config. You can use any text editor such as nano or vim to edit the file.

To open the file in nano, run the following command:

sudo nano /etc/ssh/sshd_config

Step 3: Change the SSH port

In the SSH configuration file, find the line that specifies the port and change the port number to the one you want to use. For example, if you want to change the SSH port to 2222, find the line that says #Port 22 and change it to Port 2222.

Step 4: Save and close the file

Once you have made the changes, save and close the file. In nano, you can do this by pressing Ctrl + X, then Y, and finally Enter.

Step 5: Restart the SSH service

To apply the changes, you need to restart the SSH service. Run the following command to restart the SSH service:

sudo systemctl restart sshd

Step 6: Test the new SSH port

Finally, test the new SSH port by connecting to your server using the new port number. For example, if you changed the port to 2222, run the following command to connect to your server:

ssh user@server_ip -p 2222

Replace user with your username and server_ip with your server’s IP address or hostname.

Conclusion

In this blog post, we have gone through the steps to change the SSH port on Ubuntu Server. Changing the SSH port is a simple but effective security measure to prevent unauthorized access to your server. Make sure to remember the new port number and update your firewall settings accordingly.

How to Change SSH Port on AlmaLinux

ShareTweet
Previous Post

How to Change SSH Port and Open Firewall on AlmaLinux: A Step-by-Step Guide

Next Post

Beginner’s Guide to Installing and Scanning Networks with Nmap on Kali Linux

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.