[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[1770019] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[673b0d8] | 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
| 6 | <sect1 id="ch-system-pwdgroup">
|
---|
[bce08ef] | 7 | <title>Creating the passwd, group, and log Files</title>
|
---|
[673b0d8] | 8 | <?dbhtml filename="pwdgroup.html"?>
|
---|
| 9 |
|
---|
[81fd230] | 10 | <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/etc/passwd">/etc/passwd</primary></indexterm>
|
---|
| 11 | <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/etc/group">/etc/group</primary></indexterm>
|
---|
| 12 | <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/run/utmp">/var/run/utmp</primary></indexterm>
|
---|
| 13 | <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/log/btmp">/var/log/btmp</primary></indexterm>
|
---|
| 14 | <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary></indexterm>
|
---|
| 15 | <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary></indexterm>
|
---|
| 16 |
|
---|
| 17 | <para>In order for user <emphasis>root</emphasis> to be able to login
|
---|
[373a708] | 18 | and for the name <quote>root</quote> to be recognized, there must be relevant
|
---|
| 19 | entries in the <filename>/etc/passwd</filename> and
|
---|
[81fd230] | 20 | <filename>/etc/group</filename> files.</para>
|
---|
| 21 |
|
---|
| 22 | <para>Create the <filename>/etc/passwd</filename> file by running the following
|
---|
| 23 | command:</para>
|
---|
[673b0d8] | 24 |
|
---|
[8ad7980] | 25 | <screen><userinput>cat > /etc/passwd << "EOF"
|
---|
[e2c85b1] | 26 | <literal>root:x:0:0:root:/root:/bin/bash</literal>
|
---|
[8ad7980] | 27 | EOF</userinput></screen>
|
---|
[673b0d8] | 28 |
|
---|
[81fd230] | 29 | <para>The actual password for <emphasis>root</emphasis> (the <quote>x</quote>
|
---|
| 30 | used here is just a placeholder) will be set later.</para>
|
---|
| 31 |
|
---|
| 32 | <para>Create the <filename>/etc/group</filename> file by running the following
|
---|
| 33 | command:</para>
|
---|
[673b0d8] | 34 |
|
---|
[8ad7980] | 35 | <screen><userinput>cat > /etc/group << "EOF"
|
---|
[d72e04a] | 36 | <literal>root:x:0:
|
---|
[e2c85b1] | 37 | bin:x:1:
|
---|
| 38 | sys:x:2:
|
---|
[673b0d8] | 39 | kmem:x:3:
|
---|
[e2c85b1] | 40 | tty:x:4:
|
---|
| 41 | tape:x:5:
|
---|
| 42 | daemon:x:6:
|
---|
| 43 | floppy:x:7:
|
---|
| 44 | disk:x:8:
|
---|
| 45 | lp:x:9:
|
---|
| 46 | dialout:x:10:
|
---|
| 47 | audio:x:11:
|
---|
| 48 | video:x:12:
|
---|
| 49 | utmp:x:13:
|
---|
| 50 | usb:x:14:</literal>
|
---|
[8ad7980] | 51 | EOF</userinput></screen>
|
---|
[673b0d8] | 52 |
|
---|
[6169f0c] | 53 | <para>The created groups are not part of any standard—they are groups
|
---|
| 54 | decided on in part by the requirements of the Udev configuration in the next
|
---|
| 55 | section, and in part by common convention employed by a number of existing Linux
|
---|
| 56 | distributions. The Linux Standard Base (LSB, available at <ulink
|
---|
| 57 | url="http://www.linuxbase.org"/>) recommends only that, besides the group
|
---|
| 58 | <quote>root</quote> with a Group ID (GID) of 0, a group <quote>bin</quote> with
|
---|
| 59 | a GID of 1 be present. All other group names and GIDs can be chosen freely by
|
---|
| 60 | the system administrator since well-written programs do not depend on GID
|
---|
| 61 | numbers, but rather use the group's name.</para>
|
---|
[81fd230] | 62 |
|
---|
| 63 | <para>To remove the <quote>I have no name!</quote> prompt, start a new
|
---|
| 64 | shell. Since a full Glibc was installed in <xref
|
---|
| 65 | linkend="chapter-temporary-tools"/> and the
|
---|
| 66 | <filename>/etc/passwd</filename> and <filename>/etc/group</filename>
|
---|
| 67 | files have been created, user name and group name resolution will now
|
---|
| 68 | work.</para>
|
---|
[673b0d8] | 69 |
|
---|
| 70 | <screen><userinput>exec /tools/bin/bash --login +h</userinput></screen>
|
---|
| 71 |
|
---|
[373a708] | 72 | <para>Note the use of the <parameter>+h</parameter> directive. This tells
|
---|
| 73 | <command>bash</command> not to use its internal path hashing. Without this
|
---|
| 74 | directive, <command>bash</command> would remember the paths to binaries it has
|
---|
[288dd8a] | 75 | executed. To ensure the use of the newly compiled binaries as soon as they are
|
---|
[373a708] | 76 | installed, the <parameter>+h</parameter> directive will be used for the duration
|
---|
| 77 | of this chapter.</para>
|
---|
[81fd230] | 78 |
|
---|
[f3a70cd] | 79 | <beginpage/>
|
---|
| 80 |
|
---|
[81fd230] | 81 | <para>The <command>login</command>, <command>agetty</command>, and
|
---|
| 82 | <command>init</command> programs (and others) use a number of log
|
---|
| 83 | files to record information such as who was logged into the system and
|
---|
| 84 | when. However, these programs will not write to the log files if they
|
---|
| 85 | do not already exist. Initialize the log files and give them
|
---|
| 86 | proper permissions:</para>
|
---|
[673b0d8] | 87 |
|
---|
| 88 | <screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
|
---|
[7d096f3] | 89 | chgrp utmp /var/run/utmp /var/log/lastlog
|
---|
| 90 | chmod 664 /var/run/utmp /var/log/lastlog</userinput></screen>
|
---|
[673b0d8] | 91 |
|
---|
[81fd230] | 92 | <para>The <filename>/var/run/utmp</filename> file records the users
|
---|
| 93 | that are currently logged in. The <filename>/var/log/wtmp</filename>
|
---|
| 94 | file records all logins and logouts. The
|
---|
| 95 | <filename>/var/log/lastlog</filename> file records when
|
---|
| 96 | each user last logged in. The <filename>/var/log/btmp</filename> file
|
---|
| 97 | records the bad login attempts.</para>
|
---|
| 98 |
|
---|
[673b0d8] | 99 | </sect1>
|
---|
[81fd230] | 100 |
|
---|