1. New and removed users: Useradd, related profiles, passwd, Usermod, Userdel
How do I add a user to a Linux system? Hehe ~ is too simple ~ we will enter the system when the (1) account number (2) password, so to create a usable account the same also requires both data. The account can use Useradd to create a new user, password to use passwd this command! These two instructions are issued in the following ways:
? Useradd
[[email protected] ~]# Useradd [-u UID] [-G initial Group] [-G secondary Group] [-mm]\ > [-C description Bar] [-D Home directory Absolute Path] [-s shell] user account name
Option no parameter:-U: The following is the UID, which is a set of numbers. Specify a specific UID directly to the account;-G: The group name that follows is the initial groups we mentioned above-the group GID will be placed in the/etc/passwd to the fourth field. -G: The next group name is the group that the account can join. This option parameter will modify the relevant data in the/etc/group Oh!
-m: Force do not create user home directory! (System account Default obituary value)-M: Strong Jiyu! To build user home 弽! (General account default obituary value)-C: This is the/etc/passwd of the five column of the description of the---------D: Led set an eye 弽 become a home 弽, but not to use the default obituary value. Be sure to use the Crimson Path! -R: Establish a System account, this account UID will be limited Jiyu (reference/etc/login.defs)-s: After a shell, if there is no led rule pre-training is/bin/bash ~-e: followed by a date, the format of "YYYY-MM-DD" this project can be Write the Shadow eighth field, also Shaw the account expiration date of the program, F: The next shadow the seventh field item, led the password will not be invalidated. 0 for the immediate failure, 1 for the eternal (password just will expire and strong jiyu to re-training in the login. )
Example one: Complete reference to the default set up a user named Jianguo
[Email protected] ~]# Useradd Jianguo
[[email protected] ~]# ll-d/home/jianguo drwx------4 Jianguo Jianguo 4096 Feb 09:38/home/jianguo # The user home directory is created by default and the permissions are 700! That's the point!
In fact, the system has helped us to set a very good number of default values, so we can simply use "Useradd account" to build users. CentOS these default values will mainly help us with several projects:
? In the/etc/passwd to establish a line of non-account related data, including the establishment of Uid/gid/home 弽, etc.;
? In/etc/shadow, the password related parameters of this account are filled in, but there is no password;
? Add a group name that is identical to the account name in/etc/group;
? Create a directory with the same name as the account under/home, with a permission of 700
"Account Management" under the Linux system