source: clfs-sysroot/BOOK/final-preps/creatingfiles.xml@ 83be687

Last change on this file since 83be687 was 599e966, checked in by Joe Ciccone <jciccone@…>, 18 years ago

Updated a few of the descriptions about optional users/groups.

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