[02095ae] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[c439b8a] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[02095ae] | 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="ch-final-preps-creatingfiles">
|
---|
| 9 | <?dbhtml filename="creatingfiles.html"?>
|
---|
| 10 |
|
---|
[3349a3a] | 11 | <title>Creating the passwd, group, and log Files</title>
|
---|
| 12 |
|
---|
| 13 | <indexterm zone="ch-final-preps-creatingfiles">
|
---|
| 14 | <primary sortas="e-/etc/passwd">/etc/passwd</primary>
|
---|
| 15 | </indexterm>
|
---|
| 16 |
|
---|
| 17 | <indexterm zone="ch-final-preps-creatingfiles">
|
---|
| 18 | <primary sortas="e-/etc/group">/etc/group</primary>
|
---|
| 19 | </indexterm>
|
---|
| 20 |
|
---|
| 21 | <indexterm zone="ch-final-preps-creatingfiles">
|
---|
| 22 | <primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
|
---|
| 23 | </indexterm>
|
---|
| 24 |
|
---|
| 25 | <indexterm zone="ch-final-preps-creatingfiles">
|
---|
[599e966] | 26 | <primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
|
---|
[3349a3a] | 27 | </indexterm>
|
---|
| 28 |
|
---|
| 29 | <indexterm zone="ch-final-preps-creatingfiles">
|
---|
| 30 | <primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
|
---|
| 31 | </indexterm>
|
---|
| 32 |
|
---|
| 33 | <indexterm zone="ch-final-preps-creatingfiles">
|
---|
| 34 | <primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
|
---|
| 35 | </indexterm>
|
---|
[02095ae] | 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 |
|
---|
[586feb7] | 45 | <screen><userinput>cat > ${CLFS}/etc/passwd << "EOF"
|
---|
[846eed7] | 46 | <literal>root::&uid-root;:&gid-root;:root:/root:/bin/bash</literal>
|
---|
[02095ae] | 47 | EOF</userinput></screen>
|
---|
| 48 |
|
---|
| 49 | <para>The actual password for <systemitem class="username">root</systemitem>
|
---|
[599e966] | 50 | (the <quote>::</quote> used here is just a placeholder and allow you to login
|
---|
| 51 | with no password) will be set later.</para>
|
---|
[02095ae] | 52 |
|
---|
[599e966] | 53 | <variablelist os="b">
|
---|
[f8100c0] | 54 |
|
---|
[586feb7] | 55 | <title>Additional users you may want to add:</title>
|
---|
| 56 |
|
---|
| 57 | <varlistentry>
|
---|
[846eed7] | 58 | <term><literal>bin:x:&uid-bin;:&gid-bin;:bin:/bin:/bin/false</literal></term>
|
---|
[586feb7] | 59 | <listitem>
|
---|
[b46c2f1] | 60 | <para>Can be useful for compatibility with legacy applications.</para>
|
---|
[586feb7] | 61 | </listitem>
|
---|
| 62 | </varlistentry>
|
---|
| 63 | <varlistentry>
|
---|
[846eed7] | 64 | <term><literal>daemon:x:&uid-daemon;:&uid-daemon;:daemon:/sbin:/bin/false</literal></term>
|
---|
[586feb7] | 65 | <listitem>
|
---|
[b46c2f1] | 66 | <para>It is often recommended to use an unprivileged User ID/Group ID
|
---|
| 67 | for daemons in order to limit their access to the system.</para>
|
---|
[586feb7] | 68 | </listitem>
|
---|
| 69 | </varlistentry>
|
---|
| 70 | <varlistentry>
|
---|
[846eed7] | 71 | <term><literal>adm:x:&uid-adm;:&gid-adm;:adm:/var/adm:/bin/false</literal></term>
|
---|
[586feb7] | 72 | <listitem>
|
---|
[23f9a66] | 73 | <para>Was used for programs that performed administrative tasks.</para>
|
---|
[586feb7] | 74 | </listitem>
|
---|
| 75 | </varlistentry>
|
---|
| 76 | <varlistentry>
|
---|
[846eed7] | 77 | <term><literal>lp:x:&uid-lp;:&gid-lp;:lp:/var/spool/lp:/bin/false</literal></term>
|
---|
[586feb7] | 78 | <listitem>
|
---|
[23f9a66] | 79 | <para>Used by programs for printing.</para>
|
---|
[586feb7] | 80 | </listitem>
|
---|
| 81 | </varlistentry>
|
---|
| 82 | <varlistentry>
|
---|
[846eed7] | 83 | <term><literal>mail:x:&uid-mail;:&gid-mail;:mail:/var/mail:/bin/false</literal></term>
|
---|
[586feb7] | 84 | <listitem>
|
---|
[23f9a66] | 85 | <para>Often used by email programs.</para>
|
---|
[586feb7] | 86 | </listitem>
|
---|
| 87 | </varlistentry>
|
---|
| 88 | <varlistentry>
|
---|
[846eed7] | 89 | <term><literal>news:x:&uid-news;:&gid-news;:news:/var/spool/news:/bin/false</literal></term>
|
---|
[586feb7] | 90 | <listitem>
|
---|
[23f9a66] | 91 | <para>Often used for network news servers.</para>
|
---|
[586feb7] | 92 | </listitem>
|
---|
| 93 | </varlistentry>
|
---|
| 94 | <varlistentry>
|
---|
[846eed7] | 95 | <term><literal>operator:x:&uid-operator;:&gid-root;:operator:/root:/bin/bash</literal></term>
|
---|
[586feb7] | 96 | <listitem>
|
---|
[23f9a66] | 97 | <para>Often used to allow system operators to access the system.</para>
|
---|
[586feb7] | 98 | </listitem>
|
---|
| 99 | </varlistentry>
|
---|
| 100 | <varlistentry>
|
---|
[846eed7] | 101 | <term><literal>postmaster:x:&uid-postmaster;:&gid-mail;:postmaster:/var/spool/mail:/bin/false</literal></term>
|
---|
[586feb7] | 102 | <listitem>
|
---|
[b46c2f1] | 103 | <para>Generally used as an account that receives all the information of troubles with the mail server.</para>
|
---|
[586feb7] | 104 | </listitem>
|
---|
| 105 | </varlistentry>
|
---|
| 106 | <varlistentry>
|
---|
[846eed7] | 107 | <term><literal>nobody:x:&uid-nobody;:&gid-nobody;:nobody:/:/bin/false</literal></term>
|
---|
[586feb7] | 108 | <listitem>
|
---|
[b46c2f1] | 109 | <para>Used by NFS.</para>
|
---|
[586feb7] | 110 | </listitem>
|
---|
| 111 | </varlistentry>
|
---|
| 112 | </variablelist>
|
---|
| 113 |
|
---|
[02095ae] | 114 | <para>Create the <filename>/etc/group</filename> file by running the following
|
---|
| 115 | command:</para>
|
---|
| 116 |
|
---|
[586feb7] | 117 | <screen><userinput>cat > ${CLFS}/etc/group << "EOF"
|
---|
[846eed7] | 118 | <literal>root:x:&gid-root;:
|
---|
| 119 | bin:x:&gid-bin;:
|
---|
| 120 | sys:x:&gid-sys;:
|
---|
| 121 | kmem:x:&gid-kmem;:
|
---|
| 122 | tty:x:&gid-tty;:
|
---|
| 123 | tape:x:&gid-tape;:
|
---|
| 124 | daemon:x:&gid-daemon;:
|
---|
| 125 | floppy:x:&gid-floppy;:
|
---|
| 126 | disk:x:&gid-disk;:
|
---|
| 127 | lp:x:&gid-lp;:
|
---|
| 128 | dialout:x:&gid-dialout;:
|
---|
| 129 | audio:x:&gid-audio;:
|
---|
| 130 | video:x:&gid-video;:
|
---|
| 131 | utmp:x:&gid-utmp;:
|
---|
| 132 | usb:x:&gid-usb;:
|
---|
[0566c2a] | 133 | cdrom:x:&gid-cdrom;:
|
---|
[02095ae] | 134 | EOF</userinput></screen>
|
---|
| 135 |
|
---|
[586feb7] | 136 | <variablelist os="c">
|
---|
[f8100c0] | 137 |
|
---|
[586feb7] | 138 | <title>Additional groups you may want to add</title>
|
---|
| 139 |
|
---|
| 140 | <varlistentry>
|
---|
[fc4b3c8] | 141 | <term><literal>adm:x:&gid-adm;:root,adm,daemon</literal></term>
|
---|
[586feb7] | 142 | <listitem>
|
---|
[23f9a66] | 143 | <para>All users in this group are allowed to do administrative tasks</para>
|
---|
[586feb7] | 144 | </listitem>
|
---|
| 145 | </varlistentry>
|
---|
| 146 | <varlistentry>
|
---|
[846eed7] | 147 | <term><literal>console:x:&gid-console;:</literal></term>
|
---|
[586feb7] | 148 | <listitem>
|
---|
[23f9a66] | 149 | <para>This group has direct access to the console</para>
|
---|
[586feb7] | 150 | </listitem>
|
---|
| 151 | </varlistentry>
|
---|
| 152 | <varlistentry>
|
---|
[846eed7] | 153 | <term><literal>cdrw:x:&gid-cdrw;:</literal></term>
|
---|
[586feb7] | 154 | <listitem>
|
---|
[23f9a66] | 155 | <para>This group is allowed to use the CDRW drive</para>
|
---|
[586feb7] | 156 | </listitem>
|
---|
| 157 | </varlistentry>
|
---|
| 158 | <varlistentry>
|
---|
[846eed7] | 159 | <term><literal>mail:x:&gid-mail;:mail</literal></term>
|
---|
[586feb7] | 160 | <listitem>
|
---|
| 161 | <para>Used by MTAs (Mail Transport Agents)</para>
|
---|
| 162 | </listitem>
|
---|
| 163 | </varlistentry>
|
---|
| 164 | <varlistentry>
|
---|
[846eed7] | 165 | <term><literal>news:x:&gid-news;:news</literal></term>
|
---|
[586feb7] | 166 | <listitem>
|
---|
[23f9a66] | 167 | <para>Used by Network News Servers</para>
|
---|
[586feb7] | 168 | </listitem>
|
---|
| 169 | </varlistentry>
|
---|
| 170 | <varlistentry>
|
---|
[0566c2a] | 171 | <term><literal>users:x:&gid-users;:</literal></term>
|
---|
[586feb7] | 172 | <listitem>
|
---|
[599e966] | 173 | <para>The default GID used by shadow for new users</para>
|
---|
[586feb7] | 174 | </listitem>
|
---|
| 175 | </varlistentry>
|
---|
| 176 | <varlistentry>
|
---|
[0566c2a] | 177 | <term><literal>nogroup:x:&gid-nogroup;:</literal></term>
|
---|
[586feb7] | 178 | <listitem>
|
---|
[23f9a66] | 179 | <para>This is a default group used by some programs that do not
|
---|
| 180 | require a group</para>
|
---|
[586feb7] | 181 | </listitem>
|
---|
| 182 | </varlistentry>
|
---|
| 183 | <varlistentry>
|
---|
[846eed7] | 184 | <term><literal>nobody:x:&gid-nobody;:</literal></term>
|
---|
[586feb7] | 185 | <listitem>
|
---|
[b46c2f1] | 186 | <para>This is used by NFS</para>
|
---|
[586feb7] | 187 | </listitem>
|
---|
| 188 | </varlistentry>
|
---|
| 189 | </variablelist>
|
---|
| 190 |
|
---|
[02095ae] | 191 | <para>The created groups are not part of any standard—they are groups
|
---|
| 192 | decided on in part by the requirements of the Udev configuration in this
|
---|
| 193 | chapter, and in part by common convention employed by a number of existing
|
---|
| 194 | Linux distributions. The Linux Standard Base (LSB, available at <ulink
|
---|
| 195 | url="http://www.linuxbase.org"/>) recommends only that, besides the group
|
---|
| 196 | <systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
|
---|
| 197 | a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
|
---|
| 198 | present. All other group names and GIDs can be chosen freely by the system
|
---|
| 199 | administrator since well-written programs do not depend on GID numbers, but
|
---|
| 200 | rather use the group's name.</para>
|
---|
| 201 |
|
---|
| 202 | <para>The <command>login</command>, <command>agetty</command>, and
|
---|
| 203 | <command>init</command> programs (and others) use a number of log
|
---|
| 204 | files to record information such as who was logged into the system and
|
---|
| 205 | when. However, these programs will not write to the log files if they
|
---|
| 206 | do not already exist. Initialize the log files and give them
|
---|
| 207 | proper permissions:</para>
|
---|
| 208 |
|
---|
[586feb7] | 209 | <screen><userinput>touch ${CLFS}/var/run/utmp ${CLFS}/var/log/{btmp,lastlog,wtmp}
|
---|
[90e4737] | 210 | chmod -v 664 ${CLFS}/var/run/utmp ${CLFS}/var/log/lastlog
|
---|
| 211 | chmod -v 600 ${CLFS}/var/log/btmp</userinput></screen>
|
---|
[02095ae] | 212 |
|
---|
| 213 | <para>The <filename>/var/run/utmp</filename> file records the users
|
---|
| 214 | that are currently logged in. The <filename>/var/log/wtmp</filename>
|
---|
| 215 | file records all logins and logouts. The
|
---|
| 216 | <filename>/var/log/lastlog</filename> file records when
|
---|
| 217 | each user last logged in. The <filename>/var/log/btmp</filename> file
|
---|
| 218 | records the bad login attempts.</para>
|
---|
| 219 |
|
---|
| 220 | </sect1>
|
---|