1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" |
---|
3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ |
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent"> |
---|
5 | %general-entities; |
---|
6 | ]> |
---|
7 | |
---|
8 | <sect1 id="ch-boot-pwdgroup"> |
---|
9 | <?dbhtml filename="pwdgroup.html"?> |
---|
10 | |
---|
11 | <title>Creating the passwd, group, and log Files</title> |
---|
12 | |
---|
13 | <indexterm zone="ch-boot-pwdgroup"> |
---|
14 | <primary sortas="e-${LFS}/etc/passwd">${LFS}/etc/passwd</primary> |
---|
15 | </indexterm> |
---|
16 | |
---|
17 | <indexterm zone="ch-boot-pwdgroup"> |
---|
18 | <primary sortas="e-${LFS}/etc/group">${LFS}/etc/group</primary> |
---|
19 | </indexterm> |
---|
20 | |
---|
21 | <indexterm zone="ch-boot-pwdgroup"> |
---|
22 | <primary sortas="e-${LFS}/var/run/utmp">${LFS}/var/run/utmp</primary> |
---|
23 | </indexterm> |
---|
24 | |
---|
25 | <indexterm zone="ch-boot-pwdgroup"> |
---|
26 | <primary sortas="e-${LFS}/var/log/btmp">${LFS}/var/log/btmp</primary> |
---|
27 | </indexterm> |
---|
28 | |
---|
29 | <indexterm zone="ch-boot-pwdgroup"> |
---|
30 | <primary sortas="e-${LFS}/var/log/lastlog">${LFS}/var/log/lastlog</primary> |
---|
31 | </indexterm> |
---|
32 | |
---|
33 | <indexterm zone="ch-boot-pwdgroup"> |
---|
34 | <primary sortas="e-${LFS}/var/log/wtmp">${LFS}/var/log/wtmp</primary> |
---|
35 | </indexterm> |
---|
36 | |
---|
37 | <para>In order for user <systemitem class="username">root</systemitem> to |
---|
38 | be able to login and for the name <quote>root</quote> to be recognized, |
---|
39 | there must be relevant entries in the <filename>${LFS}/etc/passwd</filename> |
---|
40 | and <filename>${LFS}/etc/group</filename> files.</para> |
---|
41 | |
---|
42 | <para>Create the <filename>${LFS}/etc/passwd</filename> file by running |
---|
43 | the following command:</para> |
---|
44 | |
---|
45 | <screen><userinput>cat > ${LFS}/etc/passwd << "EOF" |
---|
46 | <literal>root:x:0:0:root:/root:/bin/bash</literal> |
---|
47 | EOF</userinput></screen> |
---|
48 | |
---|
49 | <para os="a">The actual password for <systemitem class="username">root</systemitem> |
---|
50 | (the <quote>x</quote> used here is just a placeholder) will be set |
---|
51 | later.</para> |
---|
52 | |
---|
53 | <variablelist os="b"> |
---|
54 | |
---|
55 | <title>Additional users you may want to add:</title> |
---|
56 | |
---|
57 | <varlistentry> |
---|
58 | <term><literal>bin:x:1:1:bin:/bin:/bin/false</literal></term> |
---|
59 | <listitem> |
---|
60 | <para>To be written</para> |
---|
61 | </listitem> |
---|
62 | </varlistentry> |
---|
63 | <varlistentry> |
---|
64 | <term><literal>daemon:x:2:6:daemon:/sbin:/bin/false</literal></term> |
---|
65 | <listitem> |
---|
66 | <para>To be written</para> |
---|
67 | </listitem> |
---|
68 | </varlistentry> |
---|
69 | <varlistentry> |
---|
70 | <term><literal>adm:x:3:16:adm:/var/adm:/bin/false</literal></term> |
---|
71 | <listitem> |
---|
72 | <para>To be written</para> |
---|
73 | </listitem> |
---|
74 | </varlistentry> |
---|
75 | <varlistentry> |
---|
76 | <term><literal>lp:x:10:9:lp:/var/spool/lp:/bin/false</literal></term> |
---|
77 | <listitem> |
---|
78 | <para>To be written</para> |
---|
79 | </listitem> |
---|
80 | </varlistentry> |
---|
81 | <varlistentry> |
---|
82 | <term><literal>mail:x:30:30:mail:/var/mail:/bin/false</literal></term> |
---|
83 | <listitem> |
---|
84 | <para>To be written</para> |
---|
85 | </listitem> |
---|
86 | </varlistentry> |
---|
87 | <varlistentry> |
---|
88 | <term><literal>news:x:31:31:news:/var/spool/news:/bin/false</literal></term> |
---|
89 | <listitem> |
---|
90 | <para>To be written</para> |
---|
91 | </listitem> |
---|
92 | </varlistentry> |
---|
93 | <varlistentry> |
---|
94 | <term><literal>uucp:x:32:32:uucp:/var/spool/uucp:/bin/false</literal></term> |
---|
95 | <listitem> |
---|
96 | <para>To be written</para> |
---|
97 | </listitem> |
---|
98 | </varlistentry> |
---|
99 | <varlistentry> |
---|
100 | <term><literal>operator:x:50:0:operator:/root:/bin/bash</literal></term> |
---|
101 | <listitem> |
---|
102 | <para>To be written</para> |
---|
103 | </listitem> |
---|
104 | </varlistentry> |
---|
105 | <varlistentry> |
---|
106 | <term><literal>postmaster:x:51:30:postmaster:/var/spool/mail:/bin/false</literal></term> |
---|
107 | <listitem> |
---|
108 | <para>To be written</para> |
---|
109 | </listitem> |
---|
110 | </varlistentry> |
---|
111 | <varlistentry> |
---|
112 | <term><literal>nobody:x:65534:65534:nobody:/:/bin/false</literal></term> |
---|
113 | <listitem> |
---|
114 | <para>To be written</para> |
---|
115 | </listitem> |
---|
116 | </varlistentry> |
---|
117 | </variablelist> |
---|
118 | |
---|
119 | <para>Create the <filename>${LFS}/etc/group</filename> file by running |
---|
120 | the following command:</para> |
---|
121 | |
---|
122 | <screen><userinput>cat > ${LFS}/etc/group << "EOF" |
---|
123 | <literal>root:x:0: |
---|
124 | bin:x:1: |
---|
125 | sys:x:2: |
---|
126 | kmem:x:3: |
---|
127 | tty:x:4: |
---|
128 | tape:x:5: |
---|
129 | daemon:x:6: |
---|
130 | floppy:x:7: |
---|
131 | disk:x:8: |
---|
132 | lp:x:9: |
---|
133 | dialout:x:10: |
---|
134 | audio:x:11: |
---|
135 | video:x:12: |
---|
136 | utmp:x:13: |
---|
137 | usb:x:14: |
---|
138 | cdrom:x:15:</literal> |
---|
139 | EOF</userinput></screen> |
---|
140 | |
---|
141 | <variablelist os="c"> |
---|
142 | |
---|
143 | <title>Additional groups you may want to add</title> |
---|
144 | |
---|
145 | <varlistentry> |
---|
146 | <term><literal>adm:x:16:root,adm,daemon</literal></term> |
---|
147 | <listitem> |
---|
148 | <para>To be written</para> |
---|
149 | </listitem> |
---|
150 | </varlistentry> |
---|
151 | <varlistentry> |
---|
152 | <term><literal>console:x:17:</literal></term> |
---|
153 | <listitem> |
---|
154 | <para>To be written</para> |
---|
155 | </listitem> |
---|
156 | </varlistentry> |
---|
157 | <varlistentry> |
---|
158 | <term><literal>cdrw:x:18:</literal></term> |
---|
159 | <listitem> |
---|
160 | <para>To be written</para> |
---|
161 | </listitem> |
---|
162 | </varlistentry> |
---|
163 | <varlistentry> |
---|
164 | <term><literal>mail:x:30:mail</literal></term> |
---|
165 | <listitem> |
---|
166 | <para>Used by MTAs (Mail Transport Agents)</para> |
---|
167 | </listitem> |
---|
168 | </varlistentry> |
---|
169 | <varlistentry> |
---|
170 | <term><literal>news:x:31:news</literal></term> |
---|
171 | <listitem> |
---|
172 | <para>To be written</para> |
---|
173 | </listitem> |
---|
174 | </varlistentry> |
---|
175 | <varlistentry> |
---|
176 | <term><literal>uucp:x:32:uucp</literal></term> |
---|
177 | <listitem> |
---|
178 | <para>To be written</para> |
---|
179 | </listitem> |
---|
180 | </varlistentry> |
---|
181 | <varlistentry> |
---|
182 | <term><literal>users:x:100:</literal></term> |
---|
183 | <listitem> |
---|
184 | <para>To be written</para> |
---|
185 | </listitem> |
---|
186 | </varlistentry> |
---|
187 | <varlistentry> |
---|
188 | <term><literal>nogroup:x:65533:</literal></term> |
---|
189 | <listitem> |
---|
190 | <para>To be written</para> |
---|
191 | </listitem> |
---|
192 | </varlistentry> |
---|
193 | <varlistentry> |
---|
194 | <term><literal>nobody:x:65534:</literal></term> |
---|
195 | <listitem> |
---|
196 | <para>To be written</para> |
---|
197 | </listitem> |
---|
198 | </varlistentry> |
---|
199 | </variablelist> |
---|
200 | |
---|
201 | <para os="d">The created groups are not part of any standard—they are |
---|
202 | groups decided on in part by the requirements of the Udev configuration |
---|
203 | in the final system, and in part by common convention employed by a |
---|
204 | number of existing Linux distributions. The Linux Standard Base (LSB, |
---|
205 | available at <ulink url="http://www.linuxbase.org"/>) recommends only |
---|
206 | that, besides the group <quote>root</quote> with a Group ID (GID) of 0, |
---|
207 | a group <quote>bin</quote> with a GID of 1 be present. All other group |
---|
208 | names and GIDs can be chosen freely by the system administrator since |
---|
209 | well-written programs do not depend on GID numbers, but rather use the |
---|
210 | group's name.</para> |
---|
211 | |
---|
212 | <para os="e">The <command>login</command>, <command>agetty</command>, and |
---|
213 | <command>init</command> programs (and others) use a number of log |
---|
214 | files to record information such as who was logged into the system and |
---|
215 | when. However, these programs will not write to the log files if they |
---|
216 | do not already exist. Initialize the log files and give them |
---|
217 | proper permissions:</para> |
---|
218 | |
---|
219 | <screen><userinput>touch ${LFS}/var/run/utmp ${LFS}/var/log/{btmp,lastlog,wtmp} |
---|
220 | chmod -v 664 ${LFS}/var/run/utmp ${LFS}/var/log/lastlog |
---|
221 | chmod -v 600 ${LFS}/var/log/btmp</userinput></screen> |
---|
222 | |
---|
223 | <para>The <filename>${LFS}/var/run/utmp</filename> file records the users |
---|
224 | that are currently logged in. The <filename>${LFS}/var/log/wtmp</filename> |
---|
225 | file records all logins and logouts. The |
---|
226 | <filename>${LFS}/var/log/lastlog</filename> file records when |
---|
227 | each user last logged in. The <filename>${LFS}/var/log/btmp</filename> file |
---|
228 | records the bad login attempts.</para> |
---|
229 | |
---|
230 | </sect1> |
---|