One, LINUX (ubuntu/centos) Users add delete Modify 1, build users:
[Plain]View PlainCopy
- AddUser Web//New Web user
- Useradd web-m #添加web Users
- passwd Web//Set password for Web users
-
- Useradd web-g Admin-n-m//Create a new Web user and specify the user group as the Admin user group and automatically establish the login directory
- passwd Web//Set password for Web users
[Plain]View PlainCopy
- Useradd (option) (parameter)
-
- -c< Remarks: Add notes text. Note text is saved in the comment field of passwd;
- -d< login Directory;: Specify the starting directory for user login;
- -D: Change the preset value;
- -e< validity period;: Specify the expiry date of the account;
- -f< buffer days;: Specify how many days after the password expires to close the account;
- -g< Group;: Specify the group to which the user belongs;
- -g< Group;: Specifies the additional group to which the user belongs;
- -M: Automatically set up the user's log in directory;
- -M: Do not automatically set up the user's log in directory;
- -N: Cancels the creation of a group named after the user name;
- -R: Establish the system account number;
- -S: Specifies the shell to use when the user is logged in;
- -U: Specifies the user ID.
2. Increase the Working Group for existing users
[Plain]View PlainCopy
- Usermod-g Admin Web #Set up admin affiliate user groups for web users
#Add multiple user groups to user settings
Usermod-g web-g admin, www web ා set the main user group for web users web group, admin, www affiliated Users Group
Gpasswd-a web admin sets the admin user group for web users
3, new users at the same time increase the Working group
[Plain]View PlainCopy
- USERADD-G Admin Web//new Web user and add to admin workgroup
Note::-G belongs to the group-D home Directory-S used by the shell
4. Temporary closure
Method One
The second field (password) of the row that belongs to the user in the/etc/shadow file is preceded by a *. To restore the user, remove the *.
Method Two
To close a user account using a command:
[Plain]View PlainCopy
- passwd web–l
Re-release:
[Plain]View PlainCopy
- passwd Web–u
5. Permanently delete user account
[Plain]View PlainCopy
- Userdel Web
- Groupdel Web
- Usermod–g Web web (forcibly deleting all files and subdirectories in the user's home directory and home directory)
7. Remove users from the group
Edit/etc/group Find User group admin that row, delete user name web
or with a command.
[Plain]View PlainCopy
- gpasswd-d A Web
8. Display user Information
[HTML]View PlainCopy
- ID User
- cat/etc/passwd
Ii. User Group LINUX (ubuntu/centos) Add Delete Modify 1, build workgroup
[Plain]View PlainCopy
- Groupadd Admin//New admin Workgroup
2. Modify user groups
[Plain]View PlainCopy
- Groupmod-n newadmin Admin #修改admin用户组名称改为newadmin
3. Delete user groups
[Plain]View PlainCopy
- Groupdel Admin #删除admin用户组
4. View user group information for users
[Plain]View PlainCopy
- Groups Web #查看web所有用户组
Linux User/user group add Modify Delete (Ubuntu/centos)