By default, centos does not enable sudo and can directly log on to the server as a super administrator.
1. Add a sudo user
Run the mongodo command and find:
Add the following: (Note that sky9890 is a new common user in Linux)
# Note: You can add all permissions for the user here. The user added above has nothing to do with this experiment.
2. Prohibit Root User Logon
Edit/etc/ssh/sshd_config and set
Change
Restart sshd:
Note:
In the configuration file "/etc/ssh/sshd_config", many items have been commented out by #, which is actually effective. Permitrootlogin was not found during the first experiment, and a permitrootlogin no was added. The result shows that the remote connection is indeed unable, and the added permitrootlogin is removed from the end #PermitRootLogin
Yes. After sshd is restarted, you can connect remotely.
This article is from the "O & M" blog and will not be reproduced!
Enable sudo in centos6.6 and disable root remote logon.