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-chroot-pwdgroup">
|
---|
9 | <?dbhtml filename="pwdgroup.html"?>
|
---|
10 |
|
---|
11 | <title>Creating the passwd, group, and log Files</title>
|
---|
12 |
|
---|
13 | <indexterm zone="ch-chroot-pwdgroup">
|
---|
14 | <primary sortas="e-/etc/passwd">/etc/passwd</primary>
|
---|
15 | </indexterm>
|
---|
16 |
|
---|
17 | <indexterm zone="ch-chroot-pwdgroup">
|
---|
18 | <primary sortas="e-/etc/group">/etc/group</primary>
|
---|
19 | </indexterm>
|
---|
20 |
|
---|
21 | <indexterm zone="ch-chroot-pwdgroup">
|
---|
22 | <primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
|
---|
23 | </indexterm>
|
---|
24 |
|
---|
25 | <indexterm zone="ch-chroot-pwdgroup">
|
---|
26 | <primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <indexterm zone="ch-chroot-pwdgroup">
|
---|
30 | <primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
|
---|
31 | </indexterm>
|
---|
32 |
|
---|
33 | <indexterm zone="ch-chroot-pwdgroup">
|
---|
34 | <primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
|
---|
35 | </indexterm>
|
---|
36 |
|
---|
37 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
38 | href="../../boot/common/pwdgroup.xml"
|
---|
39 | xpointer="xpointer(//*[@os='a'])"/>
|
---|
40 |
|
---|
41 | <para>Create the <filename>/etc/passwd</filename> file by running the
|
---|
42 | following command:</para>
|
---|
43 |
|
---|
44 | <screen><userinput>cat > /etc/passwd << "EOF"
|
---|
45 | <literal>root:x:0:0:root:/root:/bin/bash</literal>
|
---|
46 | EOF</userinput></screen>
|
---|
47 |
|
---|
48 | <para os="b">The actual password for
|
---|
49 | <systemitem class="username">root</systemitem> (the <quote>x</quote>
|
---|
50 | used here is just a placeholder) will be set later.</para>
|
---|
51 |
|
---|
52 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
53 | href="../../boot/common/pwdgroup.xml"
|
---|
54 | xpointer="xpointer(//*[@os='c'])"/>
|
---|
55 |
|
---|
56 | <para>Create the <filename>/etc/group</filename> file by running the
|
---|
57 | following command:</para>
|
---|
58 |
|
---|
59 | <screen><userinput>cat > /etc/group << "EOF"
|
---|
60 | <literal>root:x:0:
|
---|
61 | bin:x:1:
|
---|
62 | sys:x:2:
|
---|
63 | kmem:x:3:
|
---|
64 | tty:x:4:
|
---|
65 | tape:x:5:
|
---|
66 | daemon:x:6:
|
---|
67 | floppy:x:7:
|
---|
68 | disk:x:8:
|
---|
69 | lp:x:9:
|
---|
70 | dialout:x:10:
|
---|
71 | audio:x:11:
|
---|
72 | video:x:12:
|
---|
73 | utmp:x:13:
|
---|
74 | usb:x:14:
|
---|
75 | cdrom:x:15:</literal>
|
---|
76 | EOF</userinput></screen>
|
---|
77 |
|
---|
78 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
79 | href="../../boot/common/pwdgroup.xml"
|
---|
80 | xpointer="xpointer(//*[@os='d'])"/>
|
---|
81 |
|
---|
82 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
83 | href="../../boot/common/pwdgroup.xml"
|
---|
84 | xpointer="xpointer(//*[@os='e'])"/>
|
---|
85 |
|
---|
86 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
87 | href="../../boot/common/pwdgroup.xml"
|
---|
88 | xpointer="xpointer(//*[@os='f'])"/>
|
---|
89 |
|
---|
90 | <para>To remove the <quote>I have no name!</quote> prompt, start a
|
---|
91 | new shell. Since a full Glibc was installed in <xref
|
---|
92 | linkend="chapter-cross-tools"/> and the <filename>/etc/passwd</filename>
|
---|
93 | and <filename>/etc/group</filename> files have been created, user name
|
---|
94 | and group name resolution will now work.</para>
|
---|
95 |
|
---|
96 | <screen role="nodump"><userinput>exec /tools/bin/bash --login +h</userinput></screen>
|
---|
97 |
|
---|
98 | <para>Note the use of the <parameter>+h</parameter> directive. This tells
|
---|
99 | <command>bash</command> not to use its internal path hashing. Without this
|
---|
100 | directive, <command>bash</command> would remember the paths to binaries it
|
---|
101 | has executed. To ensure the use of the newly compiled binaries as soon as
|
---|
102 | they are installed, the <parameter>+h</parameter> directive will be used
|
---|
103 | for the duration of the nexts chapters.</para>
|
---|
104 |
|
---|
105 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
106 | href="../../boot/common/pwdgroup.xml"
|
---|
107 | xpointer="xpointer(//*[@os='e'])"/>
|
---|
108 |
|
---|
109 | <screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
|
---|
110 | chgrp -v utmp /var/run/utmp /var/log/lastlog
|
---|
111 | chmod -v 664 /var/run/utmp /var/log/lastlog
|
---|
112 | chmod -v 600 /var/log/btmp</userinput></screen>
|
---|
113 |
|
---|
114 | <para>The <filename>/var/run/utmp</filename> file records the users that
|
---|
115 | are currently logged in. The <filename>/var/log/wtmp</filename> file records
|
---|
116 | all logins and logouts. The <filename>/var/log/lastlog</filename> file
|
---|
117 | records when each user last logged in. The <filename>/var/log/btmp</filename>
|
---|
118 | file records the bad login attempts.</para>
|
---|
119 |
|
---|
120 | </sect1>
|
---|