1. Add Users
[Email protected] testdir]# Useradd–help
Usage:useradd [Options] LOGIN
Options:
-b,–base-dir Base_dir Set the base path as the user's logon directory
-c,–comment comment comments to the user
-d,–home-dir Home_dir Setting the user's login directory
-d,–defaults changing settings
-e,–expiredate Expire_date Set the user's validity period
-f,–inactive inactive user expires, make password invalid
-g,–gid Group enables users to belong to only one group
-g,–groups groups enables users to join a group, add multiple groups, and separate them with commas.
-h,–help Help
-k,–skel Skel_dir Specify a different Skel directory
-k,–key key=value Overwrite/etc/login.defs configuration file
-m,–create-home Automatically create login directories
-L, do not add the user to the Lastlog file
-M, do not create the login directory automatically
-R, set up the system account
-o,–non-unique allows the user to have the same UID
-p,–password password using encrypted passwords for new users
-s,–shell Shell Login Time Shell
-u,–uid UID Specifies a UID for the new user
-z,–selinux-user Seuser use a specific seuser for the SELinux user mapping
passwd GW
To increase the use of GW, one thing to note, useradd add a user, do not forget to set a password for him, or the system will not be logged on by default
(It can be unlocked with usermod-u GW and cannot be fully unlocked after version six, but manually removed in/etc/passwd!) No.
2, modify the user
usermod-d/home/test-g test2 GW
Change the login directory of the test user to/home/test and join the Test2 group, note that this is the big G.
Gpasswd-a GW test2 Add user GW to Test2 Group
gpasswd-d GW test2 the user GW Remove from a test2 group
3, delete user
Userdel GW
Remove the GW user
1, create a group
Groupadd Test
Add a test group
2, modify Group
Groupmod-n test2 Test
Change the name of the test group to Test2
3, deleting a group
Groupdel test2
Delete Group Test2
4, viewing groups
A), view the group groups where the current logged-on user is located, see Test group groups Test
b), view all groups Cat/etc/group
Creation of users and groups under Linux