Because the root user has full operation permissions on the system, in order to avoid some mistakes, we recommend that you log on to the system as a general user. If necessary, you need root operation permissions, then, run the "Su-" command to log on as the root user.
1. Create an amonest account:
[Root @ localhost ~] # Useradd amonest
2. Set the amonest password:
[Root @ localhost ~] #PasswdAmonestchanging PasswordForUser amonest. New Password: # enter the password. retype new password: # enter the password again.Passwd: All authentication tokens updated successfully.
3. Add the amonest account to the wheel group.
[Root @ localhost ~] # Usermod-G wheel amonest
4. ConfigurationOnly the user in the wheel group can run the "Su-" command to log on as the root user. Users in other groups can run the "Su-" command and enter the correct root password, you cannot log on as the root user. OpenIn the/etc/PAM. d/su file, locate the following line, remove the comment and save it:
# Auth required pam_wheel.so use_uid
Then run the following command:
[Root @ localhost ~] #Echo "Su_wheel_only Yes">/Etc/Login. Defs
OK. Now you can log out of root and use amonest to log on. Run the "Su-" command when the root permission is required.
Reference connection: http://www.cnblogs.com/eastson/archive/2012/07/01/2572187.html