Modify SSH ports and disable root telnet under Linux
As we all know, SSH default port number is 22, to change the port number is 9688, need to edit/etc/ssh/ssh_config and/etc/ssh/sshd_config two files can;
To disable root login, you need to edit the/etc/ssh/sshd_config. (Some Linux directories may be/etc/sshd, please modify according to the actual situation)
The procedure is as follows:
1. Edit the/etc/ssh/ssh_config file:
[Email protected] ~]# cat/etc/ssh/ssh_config |grep Port
Port 9688
Remove the comment symbol "#" that was commented out before Port 22 and change the 22 to 9688 as above to save the exit.
2. Edit the/etc/ssh/sshd_config file:
#vim/etc/ssh/sshd_config
Find Permitrootlogin, change the following yes to No, so root cannot log in remotely, save exit.
3. Restart SSH:
#/etc/init.d/ssh restart
This successfully changes the SSH port number and disables root telnet. It is worth mentioning that if you have only the root user in Linu x, you must establish a new user before shutting down root telnet, otherwise you will not be able to log on to the server using SSH!
The contents of this article are tested under Ubuntu, and the commands in other Linux systems are similar.
Modify SSH ports and disable root telnet under Linux