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

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

r3671@server (orig r1668): jciccone | 2006-05-28 07:11:26 -0700
Added information about changing the ownership of the system and creating the neccesary device nodes.

  • Property mode set to 100644
File size: 4.2 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-${LFS}/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 ${LFS}/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; ${LFS}/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 <para>Create the <filename>/etc/group</filename> file by running the following
61 command:</para>
62
63<screen><userinput>cat &gt; ${LFS}/etc/group &lt;&lt; "EOF"
64<literal>root:x:0:
65bin:x:1:
66sys:x:2:
67kmem:x:3:
68tty:x:4:
69tape:x:5:
70daemon:x:6:
71floppy:x:7:
72disk:x:8:
73lp:x:9:
74dialout:x:10:
75audio:x:11:
76video:x:12:
77utmp:x:13:
78usb:x:14:
79cdrom:x:15:</literal>
80EOF</userinput></screen>
81
82 <para>The created groups are not part of any standard&mdash;they are groups
83 decided on in part by the requirements of the Udev configuration in this
84 chapter, and in part by common convention employed by a number of existing
85 Linux distributions. The Linux Standard Base (LSB, available at <ulink
86 url="http://www.linuxbase.org"/>) recommends only that, besides the group
87 <systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
88 a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
89 present. All other group names and GIDs can be chosen freely by the system
90 administrator since well-written programs do not depend on GID numbers, but
91 rather use the group's name.</para>
92
93 <para>The <command>login</command>, <command>agetty</command>, and
94 <command>init</command> programs (and others) use a number of log
95 files to record information such as who was logged into the system and
96 when. However, these programs will not write to the log files if they
97 do not already exist. Initialize the log files and give them
98 proper permissions:</para>
99
100<screen><userinput>touch ${LFS}/var/run/utmp ${LFS}/var/log/{btmp,lastlog,wtmp}
101chmod -v 664 ${LFS}/var/run/utmp ${LFS}/var/log/lastlog</userinput></screen>
102
103 <para>The <filename>/var/run/utmp</filename> file records the users
104 that are currently logged in. The <filename>/var/log/wtmp</filename>
105 file records all logins and logouts. The
106 <filename>/var/log/lastlog</filename> file records when
107 each user last logged in. The <filename>/var/log/btmp</filename> file
108 records the bad login attempts.</para>
109
110</sect1>
Note: See TracBrowser for help on using the repository browser.