source: chapter06/pwdgroup.xml@ dc6acb5

Last change on this file since dc6acb5 was dc6acb5, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

In DocBook-NG the replacement for <ulink> is a new definition of <link>.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/LFS-RNG/BOOK@4544 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 4.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE section [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6<section xmlns="http://docbook.org/docbook-ng"
7 xmlns:xlink="http://www.w3.org/1999/xlink"
8 xml:id="ch-system-pwdgroup">
9<title>The passwd, group and log files</title>
10<?dbhtml filename="pwdgroup.html"?>
11
12<indexterm zone="ch-system-pwdgroup"><primary sortas="e-/etc/passwd">/etc/passwd</primary></indexterm>
13<indexterm zone="ch-system-pwdgroup"><primary sortas="e-/etc/group">/etc/group</primary></indexterm>
14<indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/run/utmp">/var/run/utmp</primary></indexterm>
15<indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/log/btmp">/var/log/btmp</primary></indexterm>
16<indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary></indexterm>
17<indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary></indexterm>
18
19<para>In order for <emphasis>root</emphasis> to be able to login and for the
20name <quote>root</quote> to be recognized, there need to be relevant entries in
21the <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files.
22</para>
23
24<para>Create the <filename>/etc/passwd</filename> file by running the following
25command:</para>
26
27<screen><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
28root:x:0:0:root:/root:/bin/bash
29EOF</userinput></screen>
30
31<para>The actual password for <emphasis>root</emphasis> (the <quote>x</quote>
32here is just a placeholder) will be set later.</para>
33
34<para>Create the <filename>/etc/group</filename> file by running the following
35command:</para>
36
37<screen><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
38root:x:0:
39bin:x:1:
40sys:x:2:
41kmem:x:3:
42tty:x:4:
43tape:x:5:
44daemon:x:6:
45floppy:x:7:
46disk:x:8:
47lp:x:9:
48dialout:x:10:
49audio:x:11:
50video:x:12:
51utmp:x:13:
52usb:x:14:
53EOF</userinput></screen>
54
55<para>The created groups aren't part of any standard -- they are some of the
56groups that the Udev configuration we will be using in the next section
57uses. The LSB (<link xlink:href="http://www.linuxbase.org/">Linux Standard
58Base</link>) recommends only that, beside the group <quote>root</quote> with a
59GID of 0, a group <quote>bin</quote> with a GID of 1 be present. All other group
60names and GIDs can be chosen freely by the system administrator, since
61well-written packages don't depend on GID numbers but use the group's name.
62</para>
63
64<para>To get rid of the <quote>I have no name!</quote> prompt, we will start a
65new shell. Since we installed a full Glibc in
66<xref linkend="chapter-temporary-tools"/>, and have just created the
67<filename>/etc/passwd</filename> and <filename>/etc/group</filename> files,
68user name and group name resolution will now work.</para>
69
70<screen><userinput>exec /tools/bin/bash --login +h</userinput></screen>
71
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
74directive, <command>bash</command> would remember the paths to binaries it
75has executed. Since we want to use our newly compiled binaries as soon as
76they are installed, we turn off this function for the duration of this
77chapter.</para>
78
79<para>The <command>login</command>, <command>agetty</command> and
80<command>init</command> programs (and some others) use a number of log
81files to record information such as who was logged into the system and when.
82These programs, however, won't write to the log files if they don't already
83exist. Initialize the log files and give them their proper permissions:</para>
84
85<screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
86chgrp utmp /var/run/utmp /var/log/lastlog
87chmod 664 /var/run/utmp /var/log/lastlog</userinput></screen>
88
89<para>The <filename>/var/run/utmp</filename> file records the users that are
90currently logged in. The <filename>/var/log/wtmp</filename> file records all
91logins and logouts. The <filename>/var/log/lastlog</filename> file records for
92each user when he or she last logged in. The <filename>/var/log/btmp</filename>
93file records the bad login attempts.</para>
94
95</section>
Note: See TracBrowser for help on using the repository browser.