9.2 "Linux learning is not difficult"
User Management (
2
):
/etc/passwd
File Details
/etc/passwdfile isLinuxThe system identifies an important file for the user,Linuxall users in the system are logged in the file. Assume that the user has an accountZhangsanwhen you log in to the system, the system first checks/etc/passwddocument to see if there isZhangsanThis account and then determine the userZhangsanof theUID, throughUIDto confirm the identity of the user and read if there is/etc/shadowthe corresponding password in the file. If the password is verified correctly, log in to the system and read the user's configuration file.
any user can read /etc/passwd the contents of the file, /etc/passwd file, each line represents a user account information, one row has 7 Dan, each of the ":" delimited, below is /etc/passwd part of the file.
Root:x:0:0:root:/root:/bin/bash
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon:x:2:2:daemon:/sbin:/sbin/nologin
........................ Omitted
Sshd:x:74:74:privilege-separated Ssh:/var/empty/sshd:/sbin/nologin
Oprofile:x:16:16:special user account to being used by Oprofile:/var/lib/oprofile:/sbin/nologin
Tcpdump:x:72:72::/:/sbin/nologin
zhangsan:x:1000:1000: Zhang San:/home/zhangsan:/bin/bash
shown in the table is /etc/passwd the meaning of the fields in the file.
dan |
meaning |
user name |
also known as the login name, the user name should be unique within the system. In this example, the zhangsan |
password |
store encrypted user's password and see a x In fact the password has been mapped to /etc/shadow |
user identification Number ( UID ) |
identify users with an integer within the systemID, each user'sUIDAre the only,RootUser'sUIDis a0, the average user'sUIDDefault from +start, the user in this exampleZhangsanof theUIDis a + |
Group identification number ( ) |
Identify the primary group to which the user belongs by using an integer within the system id gid |
username full name |
user name description, can not be set. In this example, zhangsan The user's full name is Zhang San |
main directory |
First entry directory after user login system, zhangsan The user's home directory is /home/zhangsan |
login Shell |
user-Used Shell type, Linux The system uses the default Shell is a /bin/bash |
This article extracts from "Linux Learning is not difficult" textbook, which is one of the most practical, theoretical and practical Linux Introductory materials.
"Linux learning is not difficult" user management (2):/etc/passwd File Detailed Introduction