Debian Codegraph @

upstream/mageia-cauldron/man5/passwd.5

raw
1 .\" Copyright, the authors of the Linux man-pages project
2 .\"
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
4 .\"
5 .TH passwd 5 2025-09-21 "Linux man-pages 6.17"
6 .SH NAME
7 passwd \- password file
8 .SH DESCRIPTION
9 The
10 .I /etc/passwd
11 file is a text file that describes user login accounts for the system.
12 It should have read permission allowed for all users (many utilities, like
13 .BR ls (1)
14 use it to map user IDs to usernames), but write access only for the
15 superuser.
16 .P
17 In the good old days there was no great problem with this general
18 read permission.
19 Everybody could read the encrypted passwords, but the
20 hardware was too slow to crack a well-chosen password, and moreover the
21 basic assumption used to be that of a friendly user-community.
22 These days many people run some version of the shadow password suite, where
23 .I /etc/passwd
24 has an \[aq]x\[aq] character in the password field,
25 and the encrypted passwords are in
26 .IR /etc/shadow ,
27 which is readable by the superuser only.
28 .P
29 If the encrypted password, whether in
30 .I /etc/passwd
31 or in
32 .IR /etc/shadow ,
33 is an empty string, login is allowed without even asking for a password.
34 Note that this functionality may be intentionally disabled in applications,
35 or configurable (for example using the
36 .RB \[dq] nullok \[dq]
37 or
38 .RB \[dq] nonull \[dq]
39 arguments to
40 .BR pam_unix (8)).
41 .P
42 If the encrypted password in
43 .I /etc/passwd
44 is
45 .RI \[dq] *NP* \[dq]
46 (without the quotes),
47 the shadow record should be obtained from an NIS+ server.
48 .P
49 Regardless of whether shadow passwords are used, many system administrators
50 use an asterisk (*) in the encrypted password field to make sure
51 that this user can not authenticate themself using a
52 password.
53 (But see NOTES below.)
54 .P
55 If you create a new login, first put an asterisk (*) in the password field,
56 then use
57 .BR passwd (1)
58 to set it.
59 .P
60 Each line of the file describes a single user,
61 and contains seven colon-separated fields:
62 .P
63 .in +4n
64 .EX
65 name:password:UID:GID:GECOS:directory:shell
66 .EE
67 .in
68 .P
69 The field are as follows:
70 .TP 12
71 .I name
72 This is the user's login name.
73 It should not contain capital letters.
74 .TP
75 .I password
76 This is either the encrypted user password,
77 an asterisk (*), or the letter \[aq]x\[aq].
78 (See
79 .BR pwconv (8)
80 for an explanation of \[aq]x\[aq].)
81 .TP
82 .I UID
83 The privileged
84 .I root
85 login account (superuser) has the user ID 0.
86 .TP
87 .I GID
88 This is the numeric primary group ID for this user.
89 (Additional groups for the user are defined in the system group file;
90 see
91 .BR group (5)).
92 .TP
93 .I GECOS
94 This field (sometimes called the "comment field")
95 is optional and used only for informational purposes.
96 Usually, it contains the full username.
97 Some programs (for example,
98 .BR finger (1))
99 display information from this field.
100 .IP
101 GECOS stands for "General Electric Comprehensive Operating System",
102 which was renamed to GCOS when
103 GE's large systems division was sold to Honeywell.
104 Dennis Ritchie has reported: "Sometimes we sent printer output or
105 batch jobs to the GCOS machine.
106 The gcos field in the password file was a place to stash the
107 information for the $IDENTcard.
108 Not elegant."
109 .TP
110 .I directory
111 This is the user's home directory:
112 the initial directory where the user is placed after logging in.
113 The value in this field is used to set the
114 .B HOME
115 environment variable.
116 .TP
117 .I shell
118 This is the program to run at login (if empty, use
119 .IR /bin/sh ).
120 If set to a nonexistent executable, the user will be unable to login
121 through
122 .BR login (1).
123 The value in this field is used to set the
124 .B SHELL
125 environment variable.
126 .SH FILES
127 .I /etc/passwd
128 .SH NOTES
129 If you want to create user groups, there must be an entry in
130 .IR /etc/group ,
131 or no group will exist.
132 .P
133 If the encrypted password is set to an asterisk (*), the user will be unable
134 to login using
135 .BR login (1),
136 but may still login using
137 .BR rlogin (1),
138 run existing processes and initiate new ones through
139 .BR rsh (1),
140 .BR cron (8),
141 .BR at (1),
142 or mail filters, etc.
143 Trying to lock an account by simply changing the
144 shell field yields the same result and additionally allows the use of
145 .BR su (1).
146 .SH SEE ALSO
147 .BR chfn (1),
148 .BR chsh (1),
149 .BR login (1),
150 .BR passwd (1),
151 .BR su (1),
152 .BR crypt (3),
153 .BR getpwent (3),
154 .BR getpwnam (3),
155 .BR group (5),
156 .BR shadow (5),
157 .BR vipw (8)