Linux operating system is a multi-user multi-tasking operating system,
multi-user: Linux operating system may allow the establishment of multiple users, allows multiple users to log in to the system, the use of system resources
multitasking: Linux operating system allows multiple users at the same Log in to the same time the system performs a different respective tasks independently of each other and between each other
user type
Linux users generally classified into three
super-user (root UID = 0) is 0. In general UID root
normal user (UID = 500 -60000) mounted normal user UID = 500 increments (C6) .C7 starting with 1000 .
Pseudo-users (UID 1-499)
User Information file: / etc / passwd
root:x:0:0:root:/root:/bin/bash
User name
user password x is just a placeholder, there is another password / etc / shadow
user identification number UID
group identification number GID
associated notes
the user's home directory
by default shell
Password file / etc / shadow
root:$6$aGXkobiZV.ehIYZw$Yc8p31XRxSZbUpiqmxB0KmmnJpnWdAdKKHjW.FvWiUs8fFaQGEk9wASVDnhkEXwcIy3hLdgfyjWghPH57UjkK.::0:99999:7:::
User name
user password
last changed the password. 1970.1.1 modified until day from the next day the number of
the minimum time interval: the minimum time interval to change the password twice, if this field is 0, it means the function is disabled.
The maximum time interval: twice the maximum time a password modification interval: main role is to manage the user's password is valid, enhance the security of the system, root user for 99999
Warning time: How many days in advance to warn the user password has expired in the coming period, when users log in, the system will remind the user password will be set aside, in order to promptly change
the account was canceled a few days before activation: after the password expires, the system will disable the user how many days after
expiration time: from January 1, 1970 date the number of days the user account is disabled, if the field is empty, it means that the user permanently available
reserved field: currently empty, for future use Linux system development
Add user
1. Use the useradd command to add users Note: adduser command soft link to the useradd command
Options
-u Specifies to create a user's UID, does not allow the conflict
-g you want to create the user's default group
-G you want to create additional user groups, separated by commas can add multiple additional groups
-c Specifies to create a user annotations
-s specified to create a user's shell bash / bin / bash / sbin / nologin
-d Specifies to create a user's home directory (by default in / at home)
-M user to create not create home directory
-r create a system account, no default home directory
Modify user information
usermod
option
-u UID specify the user to modify the
-g Specifies the user to modify the basic group
-G to specify additional user groups you want to modify, use a comma to separate multiple additional groups, cover the original set of additional
-d you want to modify the user's home directory
-s you want to modify the user's shell bash
-c comment you want to modify user information
-l you want to modify the user's login name
-L specifies the user to lock
-U specifies the user to unlock
delete users
userdel
option
-r delete a user's home directory, as well as the user's mail
Change password
passwd
syntax
1.passwd [username]
For ordinary users can only change their own passwords, and password must be eight characters. For administrator users, plus user name may modify another user's password.
2. Results passwd --stdin by reading the output of the results assigned to the corresponding user
echo "123" | passwd --stdin user
3. The system generates a random string embedded variable
echo $ RANDOM | md5sum | cut -c 2- 10
4.mkpasswd generates a random string
options:
-l PIN code length,
-d number of sub,
-C lowercase letters,
-C uppercase,
-s special characters
Spread
whoami
Function: Displays the user name.
who
Function: Displays the current system login user information.
w
Function: Display current logged user information.