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:

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. 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. 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.

How to Change SSH Port in Linux   TecAdmin - 53

title: “How To Change Ssh Port In Linux Tecadmin” ShowToc: true date: “2022-12-08” author: “Crystal Hamilton”


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:

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. 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. 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.

How to Change SSH Port in Linux   TecAdmin - 13