[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
|
---|
| 7 | <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files.
|
---|
| 8 | Also, to support one of the coreutils tests, we will also create the user and
|
---|
| 9 | group nobody, which is almost universally present on Linux computers.</para>
|
---|
[44c2fd8] | 10 |
|
---|
[b18ab71] | 11 | <para>Create the <filename>/etc/passwd</filename> file by running the following
|
---|
| 12 | command:</para>
|
---|
[1987d72] | 13 |
|
---|
[09c1e75] | 14 | <para><screen><userinput>cat > /etc/passwd << "EOF"</userinput>
|
---|
| 15 | root:x:0:0:root:/root:/bin/bash
|
---|
| 16 | nobody:x:1000:1000:nobody:/:/bin/bash
|
---|
| 17 | <userinput>EOF</userinput></screen></para>
|
---|
[1987d72] | 18 |
|
---|
[b18ab71] | 19 | <para>The actual password for <emphasis>root</emphasis> (the "x" here is just a
|
---|
| 20 | placeholder) will be set later.</para>
|
---|
[44c2fd8] | 21 |
|
---|
[b18ab71] | 22 | <para>Create the <filename>/etc/group</filename> file by running the following
|
---|
| 23 | command:</para>
|
---|
[1987d72] | 24 |
|
---|
| 25 | <para><screen><userinput>cat > /etc/group << "EOF"</userinput>
|
---|
| 26 | root:x:0:
|
---|
| 27 | bin:x:1:
|
---|
| 28 | sys:x:2:
|
---|
| 29 | kmem:x:3:
|
---|
| 30 | tty:x:4:
|
---|
| 31 | tape:x:5:
|
---|
| 32 | daemon:x:6:
|
---|
| 33 | floppy:x:7:
|
---|
| 34 | disk:x:8:
|
---|
| 35 | lp:x:9:
|
---|
| 36 | dialout:x:10:
|
---|
| 37 | audio:x:11:
|
---|
[09c1e75] | 38 | nobody:x:1000:
|
---|
[1987d72] | 39 | <userinput>EOF</userinput></screen></para>
|
---|
| 40 |
|
---|
[b18ab71] | 41 | <para>The created groups aren't part of any standard -- they are the groups
|
---|
| 42 | that the MAKEDEV script in the next section uses. Besides the group "root", the
|
---|
| 43 | LSB (<ulink url="http://www.linuxbase.org"/>) recommends only a group "bin",
|
---|
| 44 | with a GID of 1, be present. All other group names and GIDs can be chosen
|
---|
| 45 | freely by the user, as well-written packages don't depend on GID numbers but
|
---|
| 46 | use the group's name.</para>
|
---|
| 47 |
|
---|
[1e163254] | 48 | <para>Lastly, we re-login to the chroot environment. User name and group name
|
---|
[b18ab71] | 49 | resolution will start working immediately after the
|
---|
[343070e] | 50 | <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files are
|
---|
[b18ab71] | 51 | created, because we installed a full glibc in Chapter 5. This will get rid of
|
---|
[d0ec1f0] | 52 | the <quote>I have no name!</quote> prompt.</para>
|
---|
[44c2fd8] | 53 |
|
---|
[a3e3143d] | 54 | <para><screen><userinput>exec /tools/bin/bash --login +h</userinput></screen></para>
|
---|
[bc82645e] | 55 |
|
---|
[b18ab71] | 56 |
|
---|
[1987d72] | 57 | </sect1>
|
---|
| 58 |
|
---|