pwdgroup.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.</para>
  7. <para>Create the <filename>/etc/passwd</filename> file by running the following
  8. command:</para>
  9. <screen><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"</userinput>
  10. root:x:0:0:root:/root:/bin/bash
  11. <userinput>EOF</userinput></screen>
  12. <para>The actual password for <emphasis>root</emphasis> (the "x" here is just a
  13. placeholder) will be set later.</para>
  14. <para>Create the <filename>/etc/group</filename> file by running the following
  15. command:</para>
  16. <screen><userinput>cat &gt; /etc/group &lt;&lt; "EOF"</userinput>
  17. root:x:0:
  18. bin:x:1:
  19. sys:x:2:
  20. kmem:x:3:
  21. tty:x:4:
  22. tape:x:5:
  23. daemon:x:6:
  24. floppy:x:7:
  25. disk:x:8:
  26. lp:x:9:
  27. dialout:x:10:
  28. audio:x:11:
  29. <userinput>EOF</userinput></screen>
  30. <para>The created groups aren't part of any standard -- they are the groups
  31. that the MAKEDEV script in the next section uses. Besides the group "root", the
  32. LSB (<ulink url="http://www.linuxbase.org"/>) recommends only a group "bin",
  33. with a GID of 1, be present. All other group names and GIDs can be chosen
  34. freely by the user, as well-written packages don't depend on GID numbers but
  35. use the group's name.</para>
  36. <para>Lastly, we re-login to the chroot environment. User name and group name
  37. resolution will start working immediately after the
  38. <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files are
  39. created, because we installed a full Glibc in Chapter 5. This will get rid of
  40. the <quote>I have no name!</quote> prompt.</para>
  41. <screen><userinput>exec /tools/bin/bash --login +h</userinput></screen>
  42. <para>Note the use of the <userinput>+h</userinput> directive. This tells
  43. <userinput>bash</userinput> not to use its internal path hashing. Without this
  44. directive, <userinput>bash</userinput> would remember the paths to binaries it
  45. has executed. Since as we go through this chapter, we want to use our newly
  46. compiled binaries as soon as they are installed, we turn off this function.</para>
  47. </sect1>