pwdgroup.xml 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/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. <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/etc/passwd">/etc/passwd</primary></indexterm>
  10. <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/etc/group">/etc/group</primary></indexterm>
  11. <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/run/utmp">/var/run/utmp</primary></indexterm>
  12. <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/log/btmp">/var/log/btmp</primary></indexterm>
  13. <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary></indexterm>
  14. <indexterm zone="ch-system-pwdgroup"><primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary></indexterm>
  15. <para>In order for user <emphasis>root</emphasis> to be able to login
  16. and for the name <quote>root</quote> to be recognized, there need to
  17. be relevant entries in the <filename>/etc/passwd</filename> and
  18. <filename>/etc/group</filename> files.</para>
  19. <para>Create the <filename>/etc/passwd</filename> file by running the following
  20. command:</para>
  21. <screen><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
  22. <literal>root:x:0:0:root:/root:/bin/bash
  23. nobody:x:65534:65534:Nobody:/:/sbin/nologin</literal>
  24. EOF</userinput></screen>
  25. <para>The actual password for <emphasis>root</emphasis> (the <quote>x</quote>
  26. used here is just a placeholder) will be set later.</para>
  27. <para>Create the <filename>/etc/group</filename> file by running the following
  28. command:</para>
  29. <screen><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
  30. <literal>root:x:0:
  31. console:x:1:
  32. tty:x:2:
  33. kmem:x:3:
  34. disk:x:4:
  35. utmp:x:5:
  36. nogroup:x:65534:</literal>
  37. EOF</userinput></screen>
  38. <para>The created groups are not part of any standard&mdash;they are some
  39. of the groups that the Udev configuration will be using in the next
  40. section. The Linux Standard Base (LSB, available at <ulink
  41. url="http://www.linuxbase.org"/>) recommends only that, besides the
  42. group <quote>root</quote> with a Group ID (GID) of 0, a group
  43. <quote>bin</quote> with a GID of 1 be present. All other group names
  44. and GIDs can be chosen freely by the system administrator since
  45. well-written packages do not depend on GID numbers, but rather use the
  46. group's name.</para>
  47. <para>To remove the <quote>I have no name!</quote> prompt, start a new
  48. shell. Since a full Glibc was installed in <xref
  49. linkend="chapter-temporary-tools"/> and the
  50. <filename>/etc/passwd</filename> and <filename>/etc/group</filename>
  51. files have been created, user name and group name resolution will now
  52. work.</para>
  53. <screen><userinput>exec /tools/bin/bash --login +h</userinput></screen>
  54. <para>Note the use of the <parameter>+h</parameter> directive. This
  55. tells <command>bash</command> not to use its internal path hashing.
  56. Without this directive, <command>bash</command> would remember the
  57. paths to binaries it has executed. In order to use the newly compiled
  58. binaries as soon as they are installed, turn off this function for the
  59. duration of this chapter.</para>
  60. <para>The <command>login</command>, <command>agetty</command>, and
  61. <command>init</command> programs (and others) use a number of log
  62. files to record information such as who was logged into the system and
  63. when. However, these programs will not write to the log files if they
  64. do not already exist. Initialize the log files and give them
  65. proper permissions:</para>
  66. <screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
  67. chgrp utmp /var/run/utmp /var/log/lastlog
  68. chmod 664 /var/run/utmp /var/log/lastlog</userinput></screen>
  69. <para>The <filename>/var/run/utmp</filename> file records the users
  70. that are currently logged in. The <filename>/var/log/wtmp</filename>
  71. file records all logins and logouts. The
  72. <filename>/var/log/lastlog</filename> file records when
  73. each user last logged in. The <filename>/var/log/btmp</filename> file
  74. records the bad login attempts.</para>
  75. </sect1>