Before centos is used, Ubuntu is used. Therefore, the two commands useradd and adduser are ambiguous. on Ubuntu, these two commands are used, while on centos, the same command is used, adduser is a link.
# Ll/usr/sbin/| grep userlrwxrwxrwx. 1 Root 7 October 30 17:09 adduser-> useradd-rwxr-x ---. 1 Root 114064 June 10 09:16 useradd
1. Add a user. centos does not have any interaction actions! After creating a user, you must change the password. Otherwise, you cannot log in.
# Useradd Dev # create a user # passwd Dev # change the password to change the user's Dev password. New Password: re-enter the new password passwd: All authentication tokens have been successfully updated.
2. Add the sudo permission for the new user. Otherwise, it is not appropriate to ask the root boss about everything. You know!
1) Add writable permissions to the sudoers file
# Keep the permission mode of chmod-v U + w/etc/sudoers "/etc/sudoers as 0640 (RW-r -----)
2) Add new user information to # allow root to run any commands anywher In the sudoers file.
# Allow root to run any commands anywherroot all = (all) alldev all = (all) All # Add User Information
3) cancel the sudoers file write permission
# chmod -v u-w /etc/sudoersmode of "/etc/sudoers" changed from 0640 (rw-r-----) to 0440 (r--r-----)
Adding users to centos 7 Learning