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