How to change the default SSH port on CentOS 7?
To change the default SSH port on CentOS 7, you can follow these steps:
- Log in to the root account on the CentOS 7 server.
- Open the SSH configuration file sshd_config. You can use the following command to open the file:
- Open the sshd_config file located in /etc/ssh/ folder using the vi text editor.
- Find and edit the line #Port 22 in the file. Modify it to the new port number you want to use, such as Port 2222.
- Save and close the file.
- Restart the SSH service to apply the changes. You can restart the SSH service using the following command:
- Restart the SSH service using systemctl.
Now you have successfully changed the default SSH port on CentOS 7. Make sure to use the new port number when connecting to the server.