source: chapter06/pwdgroup.xml@ df8334f

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.0 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since df8334f was 7d096f3, checked in by Zack Winkles <winkie@…>, 20 years ago
  • Add 'utmp' group
  • Upgraded to latest bootscripts to support utmp group

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