User management:
useradd [option] USERNAME
-U UID USERNAME
-G GID
-G GID,... (Multiple additional groups comma separated)
-C "COMMENT" specifies annotation information
-d/path/to/somedirectory Specifying a directory
-S shell specifies the directory path of the shell
-m-k forcibly copying bash's configuration file by default is to copy the past
-m not to create home directory
-R Add a system user 1-499 system user cannot login system no home directory
/etc/skel Personal Bash configuration file
/etc/shells: Specifies the security shell that is available for the current system
The default ID number is the ID number +1 that currently exists
You can use the Echo $SHELL to view the shell you are using
Useradd-u user1
Useradd-g Helloa user2 Add a user to a specified user group
Useradd-g MyGroup User3
Useradd-c "Tony blare"-d/home/blare user4
Tail-1/etc/passwd can see the last line
Useradd-s/sbin/nologin User5 not to use the shell
useradd-s/bin/tcshell using Tcshell
Useradd-m User7
Environment variables
PATH
SHELL
Histsize
ID View user account properties
ID User1
ID is empty property of the currently logged on user
Id-u
-G
-G
-N
Finger User View account information
Timed task mail, etc.
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "border=" 0 "style=" Background:url ("/e/u261/ Lang/zh-cn/images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>
Userdel user1
User Delete user's home directory is not deleted
Userdel-r Username Delete User at the same time delete home directory
How to modify user account properties
Usermod
-U UID Change ID
-G GID reorganization must have existed beforehand
-G If the previous add-on group is removed before the addition of the specified new will overwrite the previous additional group
-a-g GID Append additional group does not overwrite
-C Modify Comment information
-D directory If the user is logged in with a new file modification, the original directory file cannot be accessed.
-d-m directory modifies home directory location and moves home directory files to the new home directory
-S Change shell
-L Switch User name
-L Lock Account
-U: Unlock Account
Usermode-u 2002 User3 Change ID
CHSH User: Modify the default shell for users
CHFN User Comment Information modified
Password management
passwd [USERNAME]
--stdin standard input password from standard
-L Lock user account lock
-U unlock Unlock
-N Minimum Password usage period
-D Delete User password
echo "Redhat" | passwd--stdin user3 Accept character Change password from pipe
passwd-d user3 clear user3 password blank password cannot log in
Pwck Checking user account Integrity
Group Management:
To create a group:
Groupadd
-G GID
-R added as System group
Groupmod
-G GID
-N GRPNAME Revision group name
Groupdel Deleting a group
GPASSWD setting a password for a group
NEWGRP GRPNAME <-->exit Switch New group--Exit
GPASSWD MyGroup Set Password
NEWGRP MyGroup Switch to a new group if you belong to a basic group that does not need to switch
Exit the newly logged in group
Useradd-r Apache System Group
Groupadd-r Nginx
change user Password expiration time
Chage
-d Specifies the last modification time
-E Expiration Time
-I: Inactive time
-m minimum term of use
-M maximum lifespan
-W Warning Time
This article is from the "Jiawu notes" blog, so be sure to keep this source http://jiawu.blog.51cto.com/9349234/1586770
04_01 Linux User management commands (bottom)