source: chapter06/pwdgroup.xml@ 50e693d

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.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 50e693d was be7082f, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Redaction correction: Udev is configured in this chapter.

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

  • Property mode set to 100644
File size: 4.2 KB
RevLine 
[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
[bc2136e]18and for the name <quote>root</quote> to be recognized, there must be relevant
19entries 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
23command:</para>
[673b0d8]24
[8ad7980]25<screen><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
[e2c85b1]26<literal>root:x:0:0:root:/root:/bin/bash</literal>
[8ad7980]27EOF</userinput></screen>
[673b0d8]28
[81fd230]29<para>The actual password for <emphasis>root</emphasis> (the <quote>x</quote>
30used here is just a placeholder) will be set later.</para>
31
[cad7b50]32<para>Create the <filename>/etc/group</filename> file by running the following
[81fd230]33command:</para>
[673b0d8]34
[8ad7980]35<screen><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
[d72e04a]36<literal>root:x:0:
[e2c85b1]37bin:x:1:
38sys:x:2:
[673b0d8]39kmem:x:3:
[e2c85b1]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:
[3da377d]50usb:x:14:
51cdrom:x:15:</literal>
[8ad7980]52EOF</userinput></screen>
[673b0d8]53
[d001e2b]54<para>The created groups are not part of any standard&mdash;they are groups
[be7082f]55decided on in part by the requirements of the Udev configuration in this
[b2812fc]56chapter, and in part by common convention employed by a number of existing Linux
[d001e2b]57distributions. The Linux Standard Base (LSB, available at <ulink
58url="http://www.linuxbase.org"/>) recommends only that, besides the group
59<quote>root</quote> with a Group ID (GID) of 0, a group <quote>bin</quote> with
60a GID of 1 be present. All other group names and GIDs can be chosen freely by
61the system administrator since well-written programs do not depend on GID
62numbers, but rather use the group's name.</para>
[81fd230]63
64<para>To remove the <quote>I have no name!</quote> prompt, start a new
65shell. Since a full Glibc was installed in <xref
66linkend="chapter-temporary-tools"/> and the
67<filename>/etc/passwd</filename> and <filename>/etc/group</filename>
68files have been created, user name and group name resolution will now
69work.</para>
[673b0d8]70
[cad7b50]71<screen role="nodump"><userinput>exec /tools/bin/bash --login +h</userinput></screen>
[673b0d8]72
[bc2136e]73<para>Note the use of the <parameter>+h</parameter> directive. This tells
74<command>bash</command> not to use its internal path hashing. Without this
75directive, <command>bash</command> would remember the paths to binaries it has
[7678532]76executed. To ensure the use of the newly compiled binaries as soon as they are
[bc2136e]77installed, the <parameter>+h</parameter> directive will be used for the duration
78of this chapter.</para>
[81fd230]79
80<para>The <command>login</command>, <command>agetty</command>, and
81<command>init</command> programs (and others) use a number of log
82files to record information such as who was logged into the system and
83when. However, these programs will not write to the log files if they
[cad7b50]84do not already exist. Initialize the log files and give them
[81fd230]85proper permissions:</para>
[673b0d8]86
87<screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
[5998892]88chgrp -v utmp /var/run/utmp /var/log/lastlog
89chmod -v 664 /var/run/utmp /var/log/lastlog</userinput></screen>
[673b0d8]90
[81fd230]91<para>The <filename>/var/run/utmp</filename> file records the users
92that are currently logged in. The <filename>/var/log/wtmp</filename>
93file records all logins and logouts. The
94<filename>/var/log/lastlog</filename> file records when
95each user last logged in. The <filename>/var/log/btmp</filename> file
96records the bad login attempts.</para>
97
[673b0d8]98</sect1>
[81fd230]99
Note: See TracBrowser for help on using the repository browser.