1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3CR2//EN" "http://www.docbook.org/xml/4.3CR2/docbookx.dtd">
3 <sect1 id="ch06-pwdgroup">
4 <title>Creating the passwd and group files</title>
5 <?dbhtml filename="pwdgroup.html"?>
7 <para>In order for <emphasis>root</emphasis> to be able to login and for the
8 name "root" to be recognized, there need to be relevant entries in the
9 <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files.</para>
11 <para>Create the <filename>/etc/passwd</filename> file by running the following
14 <screen><userinput>cat > /etc/passwd << "EOF"</userinput>
15 root:x:0:0:root:/root:/bin/bash
16 <userinput>EOF</userinput></screen>
18 <para>The actual password for <emphasis>root</emphasis> (the "x" here is just a
19 placeholder) will be set later.</para>
21 <para>Create the <filename>/etc/group</filename> file by running the following
24 <screen><userinput>cat > /etc/group << "EOF"</userinput>
37 <userinput>EOF</userinput></screen>
39 <para>The created groups aren't part of any standard -- they are the groups
40 that the MAKEDEV script in the next section uses. Besides the group "root", the
41 LSB (<ulink url="http://www.linuxbase.org"/>) recommends only a group "bin",
42 with a GID of 1, be present. All other group names and GIDs can be chosen
43 freely by the user, as well-written packages don't depend on GID numbers but
44 use the group's name.</para>
46 <para>Lastly, we re-login to the chroot environment. User name and group name
47 resolution will start working immediately after the
48 <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files are
49 created, because we installed a full Glibc in Chapter 5. This will get rid of
50 the <quote>I have no name!</quote> prompt.</para>
52 <screen><userinput>exec /tools/bin/bash --login +h</userinput></screen>
54 <para>Note the use of the <userinput>+h</userinput> directive. This tells
55 <userinput>bash</userinput> not to use its internal path hashing. Without this
56 directive, <userinput>bash</userinput> would remember the paths to binaries it
57 has executed. Since we want to use our newly compiled binaries as soon as
58 they are installed, we turn off this function for the duration of this