Linux User management commands (version 2)
Add User
1. useradd-set Option username [-D view default parameters]
Option:
U: UID (which must not be in the system]
G: Default User Group GID [preferably]
G: specify multiple groups to which the user belongs. You can specify the department to which the user belongs]
D: Specifies the home directory]
S: Command Interpreter Shell [must be included in the/etc/shells file]
C: Description (which can be used to describe who the user is and what permissions the user has]
E: Specifies the user expiration time.
E. g.
Useradd-u 6666-g root-G sys, apache-d/project-s/bin/bash-c "Project manege"-e 2014-2-23 jack
2. Set Password: passwd jack
Delete a user
Userdel [user name] # delete a user. However, the user's home directory is retained.
Userdel-r [user name] # Delete the user's home directory
Add Group
Groupadd webadmin
Or: groupadd-g 8888 webadmin # specify GID = 8888
Save group information in the/etc/group file]
Add User to group and group management commands
To add users to a group: if a file needs to grant special permissions to several users, add these users to the group.
Method 1,
Usermod-G [group name] [user name]
Method 2: [set the group password and members in the management group using gpasswd] <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD48cD4JZ3Bhc3N3ZCAJLWEgW9PDu6fD + 10gW9fpw/5E/zb71_vcd48dgfiber gugy2vsbhbhzgrpbmc9 "0" cellspacing = "0">
-D. delete a user from the user group.
-A sets the user group administrator. This user can directly participate in the management of this group.
-R: delete user group password
-R: Prohibit users from switching to this group, for example, gpasswd-R webadmin.
Set a password for the group: gpasswd [groupname]
Save the group password in the/etc/gshadow file]
Switch the current user to the group
Switch the current user to a new group: newgrp
Enter the password :*****
View Current Account Information: id
View the group to which the current user belongs: groups
Description: authorizes jack and mary to write the directory/software.
Resolution: Authorize the directory to the user group, and then add users to the group, which is equivalent to authorizing these users
1. Create a directory: mkdir/software
2. Add group: groupadd softadm
3. Add a user to the group: usermod-G softadm jack
Gpasswd-a mary softadm
4. Change the directory group: chgrp softadm/software
5. Change the directory group permission: chmod g + w/software
6. view the directory information: ls-ld/software