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-system-pwdgroup">
|
---|
9 | <?dbhtml filename="pwdgroup.html"?>
|
---|
10 |
|
---|
11 | <title>Creating the passwd, group, and log Files</title>
|
---|
12 |
|
---|
13 | <indexterm zone="ch-system-pwdgroup">
|
---|
14 | <primary sortas="e-/etc/passwd">/etc/passwd</primary>
|
---|
15 | </indexterm>
|
---|
16 |
|
---|
17 | <indexterm zone="ch-system-pwdgroup">
|
---|
18 | <primary sortas="e-/etc/group">/etc/group</primary>
|
---|
19 | </indexterm>
|
---|
20 |
|
---|
21 | <indexterm zone="ch-system-pwdgroup">
|
---|
22 | <primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
|
---|
23 | </indexterm>
|
---|
24 |
|
---|
25 | <indexterm zone="ch-system-pwdgroup">
|
---|
26 | <primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <indexterm zone="ch-system-pwdgroup">
|
---|
30 | <primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
|
---|
31 | </indexterm>
|
---|
32 |
|
---|
33 | <indexterm zone="ch-system-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 be
|
---|
38 | able to login and for the name <quote>root</quote> to be recognized, there
|
---|
39 | must be relevant entries in the <filename>/etc/passwd</filename> and
|
---|
40 | <filename>/etc/group</filename> files.</para>
|
---|
41 |
|
---|
42 | <para>Create the <filename>/etc/passwd</filename> file by running the following
|
---|
43 | command:</para>
|
---|
44 |
|
---|
45 | <screen><userinput>cat > /etc/passwd << "EOF"
|
---|
46 | <literal>root:x:0:0:root:/root:/bin/bash</literal>
|
---|
47 | EOF</userinput></screen>
|
---|
48 |
|
---|
49 | <para>The actual password for <systemitem class="username">root</systemitem>
|
---|
50 | (the <quote>x</quote> used here is just a placeholder) will be set later.</para>
|
---|
51 |
|
---|
52 | <para>Create the <filename>/etc/group</filename> file by running the following
|
---|
53 | command:</para>
|
---|
54 |
|
---|
55 | <screen><userinput>cat > /etc/group << "EOF"
|
---|
56 | <literal>root:x:0:
|
---|
57 | bin:x:1:
|
---|
58 | sys:x:2:
|
---|
59 | kmem:x:3:
|
---|
60 | tty:x:4:
|
---|
61 | tape:x:5:
|
---|
62 | daemon:x:6:
|
---|
63 | floppy:x:7:
|
---|
64 | disk:x:8:
|
---|
65 | lp:x:9:
|
---|
66 | dialout:x:10:
|
---|
67 | audio:x:11:
|
---|
68 | video:x:12:
|
---|
69 | utmp:x:13:
|
---|
70 | usb:x:14:
|
---|
71 | cdrom:x:15:</literal>
|
---|
72 | EOF</userinput></screen>
|
---|
73 |
|
---|
74 | <para>The created groups are not part of any standard—they are groups
|
---|
75 | decided on in part by the requirements of the Udev configuration in this
|
---|
76 | chapter, and in part by common convention employed by a number of existing
|
---|
77 | Linux distributions. The Linux Standard Base (LSB, available at <ulink
|
---|
78 | url="http://www.linuxbase.org"/>) recommends only that, besides the group
|
---|
79 | <systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
|
---|
80 | a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
|
---|
81 | present. All other group names and GIDs can be chosen freely by the system
|
---|
82 | administrator since well-written programs do not depend on GID numbers, but
|
---|
83 | rather use the group's name.</para>
|
---|
84 |
|
---|
85 | <para>To remove the <quote>I have no name!</quote> prompt, start a new
|
---|
86 | shell. Since a full Glibc was installed in <xref
|
---|
87 | linkend="chapter-temporary-tools"/> and the
|
---|
88 | <filename>/etc/passwd</filename> and <filename>/etc/group</filename>
|
---|
89 | files have been created, user name and group name resolution will now
|
---|
90 | work.</para>
|
---|
91 |
|
---|
92 | <screen role="nodump"><userinput>exec /tools/bin/bash --login +h</userinput></screen>
|
---|
93 |
|
---|
94 | <para>Note the use of the <parameter>+h</parameter> directive. This tells
|
---|
95 | <command>bash</command> not to use its internal path hashing. Without this
|
---|
96 | directive, <command>bash</command> would remember the paths to binaries it has
|
---|
97 | executed. To ensure the use of the newly compiled binaries as soon as they are
|
---|
98 | installed, the <parameter>+h</parameter> directive will be used for the duration
|
---|
99 | of this chapter.</para>
|
---|
100 |
|
---|
101 | <para>The <command>login</command>, <command>agetty</command>, and
|
---|
102 | <command>init</command> programs (and others) use a number of log
|
---|
103 | files to record information such as who was logged into the system and
|
---|
104 | when. However, these programs will not write to the log files if they
|
---|
105 | do not already exist. Initialize the log files and give them
|
---|
106 | proper permissions:</para>
|
---|
107 |
|
---|
108 | <screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
|
---|
109 | chgrp -v utmp /var/run/utmp /var/log/lastlog
|
---|
110 | chmod -v 664 /var/run/utmp /var/log/lastlog</userinput></screen>
|
---|
111 |
|
---|
112 | <para>The <filename>/var/run/utmp</filename> file records the users
|
---|
113 | that are currently logged in. The <filename>/var/log/wtmp</filename>
|
---|
114 | file records all logins and logouts. The
|
---|
115 | <filename>/var/log/lastlog</filename> file records when
|
---|
116 | each user last logged in. The <filename>/var/log/btmp</filename> file
|
---|
117 | records the bad login attempts.</para>
|
---|
118 |
|
---|
119 | </sect1>
|
---|