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