Add users to Centos 7
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.
[Plain] view plaincopy
- # Ll/usr/sbin/| grepuser
- Lrwxrwxrwx.1rootroot7 October 30 17: 09adduser-> useradd
- -Rwxr-x ---. 1rootroot114064 August 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 on to [plain] view plaincopy.
- # Useradddev # create a user
- # Passwddev # change the password
- Change the 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
[Plain] view plaincopy
- # Chmod-vu + w/etc/sudoers
- The permission mode of "/etc/sudoers" is retained to 0640 (rw-r -----)
2) Add new user information in the sudoers file to # Allow root to run any commands anywher. The modified result is [plain] view plaincopy.
- # Allowroottorunanycommandsanywher
- RootALL = (ALL) ALL
- DevALL = (ALL) ALL # Add User Information
3) cancel the sudoers file write permission
[Plain] view plaincopy
- # Chmod-vu-w/etc/sudoers
- Modeof "/etc/sudoers" changedfrom0640 (rw-r -----) to0440 (r -- r -----)