1 | <sect1 id="ch06-pwdgroup">
|
---|
2 | <title>Creating the passwd and group files</title>
|
---|
3 | <?dbhtml filename="pwdgroup.html" dir="chapter06"?>
|
---|
4 |
|
---|
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
|
---|
8 | <filename>/etc/group</filename> files. Also, to support one of the coreutils
|
---|
9 | tests, we will also create the user and group nobody, which is almost
|
---|
10 | universally present on Linux computers.</para>
|
---|
11 |
|
---|
12 | <para>Create the <filename>/etc/passwd</filename> file by running the
|
---|
13 | following command:</para>
|
---|
14 |
|
---|
15 | <para><screen><userinput>cat > /etc/passwd << "EOF"</userinput>
|
---|
16 | root:x:0:0:root:/root:/bin/bash
|
---|
17 | nobody:x:1000:1000:nobody:/:/bin/bash
|
---|
18 | <userinput>EOF</userinput></screen></para>
|
---|
19 |
|
---|
20 | <para>The actual password for <emphasis>root</emphasis> (the "x" here is
|
---|
21 | just a placeholder) will be set later.</para>
|
---|
22 |
|
---|
23 | <para>Create the <filename>/etc/group</filename> file by running the
|
---|
24 | following command:</para>
|
---|
25 |
|
---|
26 | <para><screen><userinput>cat > /etc/group << "EOF"</userinput>
|
---|
27 | root:x:0:
|
---|
28 | bin:x:1:
|
---|
29 | sys:x:2:
|
---|
30 | kmem:x:3:
|
---|
31 | tty:x:4:
|
---|
32 | tape:x:5:
|
---|
33 | daemon:x:6:
|
---|
34 | floppy:x:7:
|
---|
35 | disk:x:8:
|
---|
36 | lp:x:9:
|
---|
37 | dialout:x:10:
|
---|
38 | audio:x:11:
|
---|
39 | nobody:x:1000:
|
---|
40 | <userinput>EOF</userinput></screen></para>
|
---|
41 |
|
---|
42 | <para>The created groups aren't part of any standard -- they are the groups
|
---|
43 | that the MAKEDEV script in the next section uses. Besides the group "root",
|
---|
44 | the LSB (<ulink url="http://www.linuxbase.org"/>) recommends only a group
|
---|
45 | "bin", with a GID of 1, be present. All other group names and GIDs can be
|
---|
46 | chosen freely by the user, as well-written packages don't depend on GID
|
---|
47 | numbers but use the group's name.</para>
|
---|
48 |
|
---|
49 | <para><screen><userinput>exec /stage1/bin/bash --login
|
---|
50 | set +h</userinput></screen></para>
|
---|
51 |
|
---|
52 | </sect1>
|
---|
53 |
|
---|