Get the App
SLTechnology News&Howtos  ›  Development  › 

How to change the SSH port number under Linux

Shulou Source: shulou.com Published: 2022-06-01 20:47:09 11月17日 Update

This article mainly introduces the relevant knowledge of how to change the SSH port number under Linux, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to change the SSH port number under Linux. Let's take a look.

Linux is generally used as a server, and the server is generally placed in the computer room, so it is impossible for you to operate your Linux server in the computer room, so we need to log in remotely to the Linux server to manage and maintain the system. In the Linux system, the remote login function is realized through the ssh service. The default ssh service port number is 22, but the SSH port number is usually changed for security.

1. Edit the sshd_config file nano / etc/ssh/sshd_config

Search for line # Port 22, remove the first # character, and replace it with the port you want to use, for example, 2404. Make sure that there are no running services on this port 2404.

two。 Restart the sshd service service sshd restart3. [option] if you are using a firewall like iptables, you need to open port 2404. This is the end of the article service iptables stopiptables-An INPUT-m state-state NEW-m tcp-p tcp-dport 2404-j ACCEPTservice iptables saveservice iptables start on how to change the SSH port number under Linux. Thank you for reading! I believe you all have a certain understanding of "how to change the SSH port number under Linux". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Service slogan server knowledge port content computer room current article system login security value function character regular meeting beginning simple operation file article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MariaDB Huawei Microsoft Docker