First open the /etc/ssh/sshd.config file
vim /etc/ssh/sshd_config
Find the configuration
#PermitRootLogin yes
Modify it to
PermitRootLogin no
As shown in the figure below:
Restart the sshd service, the command is as follows:
systemctl restart sshd.service
Recommended tutorial:centos tutorial
The above is the detailed content of How to prevent root users from logging in directly in centos. For more information, please follow other related articles on the PHP Chinese website!