Project |
Command |
Command explanation |
Example description |
Command Help View |
Whatis |
Show Manuals |
Command format:
Whatis [-DLV? V] [-r|-w] [-S list] [-M system[,...]] [-M path] [-L Locale] [-c file] name ... Example: Whatis passwd, and then the man 5 passwd View related commands explained 650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/72/2A/ Wkiol1xefluhnh5naaavne1gejq286.jpg "width=" 269 "height="/> |
User Management |
Useradd |
Add user, unspecified when added, automatically creates a basic group with the same user name Basic groups are copied The corresponding hidden file in the/etc/skel/directory |
-b Base directory unspecified with -D home directory -E Expiration Time -C Note information -s Specifies the existing Shell -u uid -G group ID when logging in basic group -G additional group, extra group tease bar delimited -M Create home directory -M do not create house -R for System users non-logged in Example: Useradd 51cto Add new user 51cto & nbsp Automatically generate Uid,gid output to 51cto:x:3001:3001::/home/51cto:/bin/bash Example 2:useradd-u 3003 with tail–1/etc/passwd view of newly added users user01 Add New user User01, specify user ID 3003 Example 3:useradd-u 3000-d/home/database-g sql,database Oracle Create new user Oracle, Specify user ido 3000, home directory/home/database, SQL, database two group Example 4:useradd-s/bin/csh cshuser specify Cshuser use CSH Example 5:useradd-r-s/sbin/nologin-m sysuser Creating a system user Sysuser Output sysuser:x:992:990::/home/sysuser:/sbin/ Nologin CentOS 7 1000 Below is the system user |
user management |
usermod |
Modify User Properties |
command format: usermod [options] LOGIN -D home directory -E Expiration Time -U uid -L Modify Login Example: usermod-g 3001 user01 modify User01 Group ID for 3001 output: id User01 View: Both the original GID and groups IDs are modified to 3001 uid=3003 (User01) gid=3001 (51cto) groups=3001 (51cto) |
User Management |
passwd |
Set Password: Normal users can modify their own password, the administrator can modify other user passwords |
Command format:
passwd [-K] [-l] [-u [-f]] [-d] [-e] [-N mindays] [-X Maxdays] [-W Warndays] [-I inactivedays] [-S] [--stdin] [username] passwd [Username] more commonly used --stdin Accept new password from standard input -L Lock User-U to unlock user Example: passwd 51cto Input two times New password confirm Echo ' 51cto ' |passwd--stdin 51cto modify 51cto user password to 51cto |
User Management |
Userdel |
Delete User |
Command format: Userdel [Options] LOGIN -F Force Delete -R Delete Home directory, by default not directly delete home directory Example: Userdel cshuser Deleting a user Cshuser |
User Group Management |
Groupadd |
Add Group |
Command format: Groupadd [options] group, output can be viewed through tail–#/etc/group #后行号 -G-Finger Group id-p Group password defaults to disable Example: Groupadd cshuser Adding user groups Cshuser |
User Management |
Groupmod |
Modify Group Properties |
Command format: groupmod [options] GROUP -G Group ID Basic Group-n New name Example: Groupmod-g 4004 cshuser modification with Group Cshuser Group ID Groupmod-n Cshuserbak Cshuser Modify the Cshuser group named Cshuserbak |
User Management |
gpasswd |
Set a password for a group Typically used to toggle basic groups |
Command format: GPASSWD [option] Group -A group Add user-D removes a user from a group Example: gpasswd 51cto then enter two password confirmations |
User Management |
Groupdel |
Delete Group name |
Command format: Groupdel [options] GROUP Example: Groupdel cshuser |
User Management |
Newgrp |
Toggle Basic Group |
Command format: NEWGRP [-] [group] Example: NEWGRP user01 switch to group User01 |
User Management |
Chage |
modifying user attribute Information |
Command format: chage [options] LOGIN -D Lastday -e Expiration Time-m maximum save time -L Display Related information Example: chage-l 51cto lists existing 51cto user information 650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/72/2A/ Wkiol1xeflzxvvxtaabab41ok2q353.jpg "" Height= "/>"
|
User Management |
Chsh |
Modifying the user shell |
Command format: CHSH [-S Shell] [-l] [-u] [-v] [username] -L show Shell in/etc/shells -S Specify shell Example: Chsh-s/bin/csh user1 Modify the User1 shell for Cshell |
User Management |
Chfn |
Modify user comment Information, save information in/etc/passwd |
Command format:
CHFN [-F full-name] [-O Office], RB [-P office-phone] [-H Home-phone] -u] [-v] [username] Example: Chfn-f 51ctolinux-o shanghai-p 12345678-h 87654321 51cto 51cto User notes: Full name, office address Shanghai, phone 12345678, etc. |
User Management |
Id |
View user Information |
Command format: ID [OPTION] ... [USER] -G Basic Group-G all Groups-n name Example: ID 51cto Output uid=3001 (51cto) gid=3001 (51cto) groups=3001 (51cto) ID USER6 &>/dev/null $? Show results, whether there are users |
|
finger |
View user information, login, etc. /td> |
command format: Finger [-lmsp] [user ...] [[email protected] ...] -S login user name Example: finger-s 51cto display 51cto user information Finger 51cto login:51cto & nbsp; name:51ctolinux Directory:/home/51cto Shell:/bin/bash Office:shanghai, 12345678 Home phone:87654321 Last login Wed 16:17 (CST) on PTS/2 from 172.16.16.36 No Mail. No Plan. |
User Management |
Su |
Switch users Switch User |
Command format: Su [Options ...] [-] [user [args ...]] -Represents the switch environment variable, which is equivalent to the-l full toggle L can omit -C command to instruct the user to run the command and retrieve the password Example: su–root switch to root user Su-51cto-c ' pwd ' execute 51cto user pwd command to temporarily switch users |
User Management |
Umask |
Generally used in conjunction with chmod, modify the permissions (including the owner, group, other groups, etc.) |
Total 4 bits (GID/UID, owner, organization, other user's rights), general use after three bit Example: Umask defaults to 0022 chmod 777 A.txt refers to the owner of the file a.txt, belonging to the group and other users have read, write, execute permissions Output ls–l -rwxrwxrwx. 1 root root 2504 18:14 a.txt |