How to Enable or Disable IPV6 on Ubuntu Linux
IPv6, also known as Internet Protocol version 6, offers...
SSH (Secure Shell) is a powerful tool for remote server management in Linux-based operating systems including Ubuntu. It is used to access remote servers securely.
SSH operates on the default port 22, which can be easily targeted by attackers. Thus, you can modify the port to protect your system from such kinds of cyber attacks.
Through this educational post, you can change SSH port on your Ubuntu Linux system.
Also, read How to Setup Passwordless SSH on Linux
Modify the current SSH port through these steps in a Linux-based system.
Step 1: Check the Current SSH Port
Before initiating the process of changing SSH port on Linux, let’s check the current SSH port on your Ubuntu system:
sudo ss -tulpn | grep ssh
The provided command will display the current SSH port, such as port 22, on your system.
Step 2: Confirm SSH Service Connectivity
Now, make sure that the SSH service is active on your system. Execute the command in your terminal to confirm SSH service connectivity:
sudo systemctl status ssh
This command will provide information about the SSH service, including its status (running/stop).
Step 3: Connect to the Remote Server via SSH
For modifications in the SSH configuration file, connect to the remote server through the command:
ssh [email protected]
Don’t forget to replace the username “techpub” with your preferred username.
Step 4: Access SSH Configuration File
Utilize the following command to access the SSH configuration file in a Nano text editor:
sudo nano /etc/ssh/sshd_config
Unlock the power of Ubuntu VPS
Experience the dependability of the most widely used Linux distribution coupled with the versatility of a virtual server. Revel in high-speed performance and minimal latency for an optimal computing experience.
Step 5: Modify SSH Port
Inside the SSH configuration file, locate the SSH port usually named #Port 22. Remove the “#” symbol at the beginning, and modify the port number to your choice like Port 2222:
Port 2222
Save the changes after modification and close by pressing Ctrl + X.
Step 6: Exit the Remote Server
Run the Exit command to logout and close the remote server:
exit
Step 7: Verify Port After Changes
Recheck the SSH port after changes through the command:
sudo ss -tulpn | grep ssh
Upon following the aforementioned steps, you have successfully changed the SSH port on your Ubuntu system.
In this article, you have learned how to change SSH port on Ubuntu. To modify the port, first, connect to the particular server and then open the configuration file via the command: “sudo nano /etc/ssh/sshd_config”. Locate the #port 22, a default SSH port, and replace the port number with your desired one.
To modify the port in Ubuntu, connect to the remote server, access the configuration file via sudo nano /etc/ssh/sshd_config, and change the default port 22. Rent a server with dependability and scalable features tailored to accommodate your expanding requirements. Discover our range of VPS plans to identify the ideal solution for your needs.
Yes, you can replace the Default port (22) with a secure one. To change it, access the SSH configuration file via sudo nano /etc/ssh/sshd_config, locate the #port 22, and change the port number.
The default port can easily be targeted by attackers, so changing it can help protect your server from these attacks.
Yes, you can check the current SSH port on your Ubuntu system by using the command sudo ss -tulpn | grep ssh.