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

Last change on this file since f8100c0 was f8100c0, checked in by Jim Gifford <clfs@…>, 18 years ago

r4323@server (orig r1904): manuel | 2006-07-04 11:50:44 -0700
Fixed a validation issue.

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