[1987d72] | 1 | <sect1 id="ch06-pwdgroup">
|
---|
[44c2fd8] | 2 | <title>Creating the passwd and group files</title>
|
---|
[1987d72] | 3 | <?dbhtml filename="pwdgroup.html" dir="chapter06"?>
|
---|
| 4 |
|
---|
[b18ab71] | 5 | <para>In order for <emphasis>root</emphasis> to be able to login and for the
|
---|
| 6 | name "root" to be recognized, there need to be relevant entries in the
|
---|
[c9fb357] | 7 | <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files.</para>
|
---|
[44c2fd8] | 8 |
|
---|
[b18ab71] | 9 | <para>Create the <filename>/etc/passwd</filename> file by running the following
|
---|
| 10 | command:</para>
|
---|
[1987d72] | 11 |
|
---|
[21ba4e3] | 12 | <screen><userinput>cat > /etc/passwd << "EOF"</userinput>
|
---|
[09c1e75] | 13 | root:x:0:0:root:/root:/bin/bash
|
---|
[21ba4e3] | 14 | <userinput>EOF</userinput></screen>
|
---|
[1987d72] | 15 |
|
---|
[b18ab71] | 16 | <para>The actual password for <emphasis>root</emphasis> (the "x" here is just a
|
---|
| 17 | placeholder) will be set later.</para>
|
---|
[44c2fd8] | 18 |
|
---|
[b18ab71] | 19 | <para>Create the <filename>/etc/group</filename> file by running the following
|
---|
| 20 | command:</para>
|
---|
[1987d72] | 21 |
|
---|
[21ba4e3] | 22 | <screen><userinput>cat > /etc/group << "EOF"</userinput>
|
---|
[1987d72] | 23 | root:x:0:
|
---|
| 24 | bin:x:1:
|
---|
| 25 | sys:x:2:
|
---|
| 26 | kmem:x:3:
|
---|
| 27 | tty:x:4:
|
---|
| 28 | tape:x:5:
|
---|
| 29 | daemon:x:6:
|
---|
| 30 | floppy:x:7:
|
---|
| 31 | disk:x:8:
|
---|
| 32 | lp:x:9:
|
---|
| 33 | dialout:x:10:
|
---|
| 34 | audio:x:11:
|
---|
[21ba4e3] | 35 | <userinput>EOF</userinput></screen>
|
---|
[1987d72] | 36 |
|
---|
[b18ab71] | 37 | <para>The created groups aren't part of any standard -- they are the groups
|
---|
| 38 | that the MAKEDEV script in the next section uses. Besides the group "root", the
|
---|
| 39 | LSB (<ulink url="http://www.linuxbase.org"/>) recommends only a group "bin",
|
---|
| 40 | with a GID of 1, be present. All other group names and GIDs can be chosen
|
---|
| 41 | freely by the user, as well-written packages don't depend on GID numbers but
|
---|
| 42 | use the group's name.</para>
|
---|
| 43 |
|
---|
[1e163254] | 44 | <para>Lastly, we re-login to the chroot environment. User name and group name
|
---|
[b18ab71] | 45 | resolution will start working immediately after the
|
---|
[343070e] | 46 | <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files are
|
---|
[4fa86d1] | 47 | created, because we installed a full Glibc in Chapter 5. This will get rid of
|
---|
[d0ec1f0] | 48 | the <quote>I have no name!</quote> prompt.</para>
|
---|
[44c2fd8] | 49 |
|
---|
[21ba4e3] | 50 | <screen><userinput>exec /tools/bin/bash --login +h</userinput></screen>
|
---|
[bc82645e] | 51 |
|
---|
[360e2c4] | 52 | <para>Note the use of the <userinput>+h</userinput> directive. This tells
|
---|
| 53 | <userinput>bash</userinput> not to use its internal path hashing. Without this
|
---|
| 54 | directive, <userinput>bash</userinput> would remember the paths to binaries it
|
---|
| 55 | has executed. Since as we go through this chapter, we want to use our newly
|
---|
| 56 | compiled binaries as soon as they are installed, we turn off this function.</para>
|
---|
[b18ab71] | 57 |
|
---|
[1987d72] | 58 | </sect1>
|
---|
| 59 |
|
---|