The default Administrator name in Linux is root. You only need to know the ROOT password to directly log on to SSH. Preventing Root users from logging on directly from SSH improves server security. After performing the following operations.
This article applies to CentOS, Debian, and other Linux systems.
1. Create an account
Useradd kwxgd
Run the preceding commands in SSH to create an account named "kwxgd", which can be customized.
Ii. Set the account password
Passwd kwxgd
Use the passwd command to set or change the password for the corresponding account.
As shown in the following figure, you need to enter the verification password twice to set or change the password. after entering the verification password, press enter to confirm.
3. Direct login by root is not allowed
1. Modify Related Files
Vi/etc/ssh/sshd_config
Run the preceding command in SSH to modify the sshd_config file.
2. Disable root Login
Find"# PermitRootLogin yes, remove "#" from the front, change "Yes" to "No" from the short tail, and save the file.
4. Next Login
1. Use the newly created account "kwxgd" to log in as a common user.
2. To obtain the ROOT permission, run the following command in SSH:
Su root
Run the preceding command and enter the root password to obtain the root permission.