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

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

r3663@server (orig r1664): jciccone | 2006-05-26 17:16:29 -0700
Added glibc-ports to arm and made a few text changes

  • Property mode set to 100644
File size: 3.5 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 Essential Files</title>
12
13 <para>A proper Linux system maintains a list of the mounted file systems in
14 the file <filename>/etc/mtab</filename>. Normally, this file would be
15 created when we mount a new file system. Since we will not be mounting any
16 file systems inside our chroot environment, create an empty file for
17 utilities that expect the presence of <filename>/etc/mtab</filename>:</para>
18
19<screen><userinput>touch ${LFS}/etc/mtab</userinput></screen>
20
21 <para>In order for user <systemitem class="username">root</systemitem> to be
22 able to login and for the name <quote>root</quote> to be recognized, there
23 must be relevant entries in the <filename>/etc/passwd</filename> and
24 <filename>/etc/group</filename> files.</para>
25
26 <para>Create the <filename>/etc/passwd</filename> file by running the following
27 command:</para>
28
29<screen><userinput>cat &gt; ${LFS}/etc/passwd &lt;&lt; "EOF"
30<literal>root:x:0:0:root:/root:/bin/bash</literal>
31EOF</userinput></screen>
32
33 <para>The actual password for <systemitem class="username">root</systemitem>
34 (the <quote>x</quote> used here is just a placeholder) will be set later.</para>
35
36 <para>Create the <filename>/etc/group</filename> file by running the following
37 command:</para>
38
39<screen><userinput>cat &gt; ${LFS}/etc/group &lt;&lt; "EOF"
40<literal>root:x:0:
41bin:x:1:
42sys:x:2:
43kmem:x:3:
44tty:x:4:
45tape:x:5:
46daemon:x:6:
47floppy:x:7:
48disk:x:8:
49lp:x:9:
50dialout:x:10:
51audio:x:11:
52video:x:12:
53utmp:x:13:
54usb:x:14:
55cdrom:x:15:</literal>
56EOF</userinput></screen>
57
58 <para>The created groups are not part of any standard&mdash;they are groups
59 decided on in part by the requirements of the Udev configuration in this
60 chapter, and in part by common convention employed by a number of existing
61 Linux distributions. The Linux Standard Base (LSB, available at <ulink
62 url="http://www.linuxbase.org"/>) recommends only that, besides the group
63 <systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
64 a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
65 present. All other group names and GIDs can be chosen freely by the system
66 administrator since well-written programs do not depend on GID numbers, but
67 rather use the group's name.</para>
68
69 <para>The <command>login</command>, <command>agetty</command>, and
70 <command>init</command> programs (and others) use a number of log
71 files to record information such as who was logged into the system and
72 when. However, these programs will not write to the log files if they
73 do not already exist. Initialize the log files and give them
74 proper permissions:</para>
75
76<screen><userinput>touch ${LFS}/var/run/utmp ${LFS}/var/log/{btmp,lastlog,wtmp}
77chgrp -v utmp ${LFS}/var/run/utmp ${LFS}/var/log/lastlog
78chmod -v 664 ${LFS}/var/run/utmp ${LFS}/var/log/lastlog</userinput></screen>
79
80 <para>The <filename>/var/run/utmp</filename> file records the users
81 that are currently logged in. The <filename>/var/log/wtmp</filename>
82 file records all logins and logouts. The
83 <filename>/var/log/lastlog</filename> file records when
84 each user last logged in. The <filename>/var/log/btmp</filename> file
85 records the bad login attempts.</para>
86
87</sect1>
Note: See TracBrowser for help on using the repository browser.