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