How can I change the remote connection port in Linux?
To change the remote connection port on Linux, you need to modify the SSH (Secure Shell) configuration file.
Here is the procedure to modify the remote connection port:
- Log in to the Linux server.
- The configuration file for the SSH daemon is located at /etc/ssh/sshd_config.
- Please open the sshd_config file in the /etc/ssh directory using the vi text editor with sudo permissions.
- – Pier
- Harbor
- Could you please tell me where the nearest restroom is located?
- Change the port number to the new one you want to use. Please note that the port number should be within the range of 1-65535 and should not conflict with other ports that are already in use.
- Save the file and exit the editor.
- Please restart the sshd service using the sudo systemctl command.
After completing the above steps, the SSH service will be listening on a new port number. Make sure you can remotely connect using the new port number and allow the port through your firewall settings.