pwdgroup.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <sect1 id="ch06-pwdgroup">
  2. <title>Creating the passwd and group files</title>
  3. <?dbhtml filename="pwdgroup.html" dir="chapter06"?>
  4. <para>In order for <emphasis>root</emphasis> to be able to login and for the
  5. name "root" to be recognized, there need to be relevant entries in the
  6. <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files.
  7. Also, to support one of the coreutils tests, we will also create the user and
  8. group nobody, which is almost universally present on Linux computers.</para>
  9. <para>Create the <filename>/etc/passwd</filename> file by running the following
  10. command:</para>
  11. <para><screen><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"</userinput>
  12. root:x:0:0:root:/root:/bin/bash
  13. nobody:x:1000:1000:nobody:/:/bin/bash
  14. <userinput>EOF</userinput></screen></para>
  15. <para>The actual password for <emphasis>root</emphasis> (the "x" here is just a
  16. placeholder) will be set later.</para>
  17. <para>Create the <filename>/etc/group</filename> file by running the following
  18. command:</para>
  19. <para><screen><userinput>cat &gt; /etc/group &lt;&lt; "EOF"</userinput>
  20. root:x:0:
  21. bin:x:1:
  22. sys:x:2:
  23. kmem:x:3:
  24. tty:x:4:
  25. tape:x:5:
  26. daemon:x:6:
  27. floppy:x:7:
  28. disk:x:8:
  29. lp:x:9:
  30. dialout:x:10:
  31. audio:x:11:
  32. nobody:x:1000:
  33. <userinput>EOF</userinput></screen></para>
  34. <para>The created groups aren't part of any standard -- they are the groups
  35. that the MAKEDEV script in the next section uses. Besides the group "root", the
  36. LSB (<ulink url="http://www.linuxbase.org"/>) recommends only a group "bin",
  37. with a GID of 1, be present. All other group names and GIDs can be chosen
  38. freely by the user, as well-written packages don't depend on GID numbers but
  39. use the group's name.</para>
  40. <para>Lastly, we re-login to the chroot environment. User name and group name
  41. resolution will start working immediately after the
  42. <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files are
  43. created, because we installed a full glibc in Chapter 5. This will get rid of
  44. the <quote>I have no name!</quote> prompt.</para>
  45. <para><screen><userinput>exec /tools/bin/bash +h --login </userinput></screen></para>
  46. </sect1>