addinguser.xml 3.3 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-tools-addinguser">
  7. <title>Adding the LFS User</title>
  8. <?dbhtml filename="addinguser.html"?>
  9. <para>When logged in as user <emphasis>root</emphasis>, making a
  10. single mistake can damage or destroy a system. Therefore, we recommend
  11. building the packages in this chapter as an unprivileged user. You
  12. could use your own user name, but to make it easier to set up a clean
  13. work environment, create a new user called <emphasis>lfs</emphasis> as
  14. a member of a new group (also named <emphasis>lfs</emphasis>) and use
  15. this user during the installation process. As
  16. <emphasis>root</emphasis>, issue the following commands to add the new
  17. user:</para>
  18. <screen><userinput>groupadd lfs
  19. useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
  20. <para>The meaning of the command line options:</para>
  21. <variablelist>
  22. <varlistentry>
  23. <term><parameter>-s /bin/bash</parameter></term>
  24. <listitem><para>This makes
  25. <command>bash</command> the default shell for user
  26. <emphasis>lfs</emphasis>.</para></listitem>
  27. </varlistentry>
  28. <varlistentry>
  29. <term><parameter>-g lfs</parameter></term>
  30. <listitem><para>This option adds user <emphasis>lfs</emphasis> to group
  31. <emphasis>lfs</emphasis>.</para></listitem>
  32. </varlistentry>
  33. <varlistentry>
  34. <term><parameter>-m</parameter></term>
  35. <listitem><para>This creates a home
  36. directory for <emphasis>lfs</emphasis>.</para></listitem>
  37. </varlistentry>
  38. <varlistentry>
  39. <term><parameter>-k /dev/null</parameter></term>
  40. <listitem><para>This parameter
  41. prevents possible copying of files from a skeleton directory (default
  42. is <filename class="directory">/etc/skel</filename>) by changing the input location to
  43. the special null device.</para></listitem>
  44. </varlistentry>
  45. <varlistentry>
  46. <term><parameter>lfs</parameter></term>
  47. <listitem><para>This is the actual name for the created group and
  48. user.</para></listitem>
  49. </varlistentry>
  50. </variablelist>
  51. <para>To log in as <emphasis>lfs</emphasis> (as opposed to switching
  52. to user <emphasis>lfs</emphasis> when
  53. logged in as <emphasis>root</emphasis>, which does not require the
  54. <emphasis>lfs</emphasis> user to have a
  55. password), give <emphasis>lfs</emphasis> a password:</para>
  56. <screen><userinput>passwd lfs</userinput></screen>
  57. <para>Grant <emphasis>lfs</emphasis> full access to
  58. <filename class="directory">$LFS/tools</filename> by making
  59. <emphasis>lfs</emphasis> the directory owner:</para>
  60. <screen><userinput>chown lfs $LFS/tools</userinput></screen>
  61. <para>If a separate working directory was created as suggested, give
  62. user <emphasis>lfs</emphasis> ownership of this directory:</para>
  63. <screen><userinput>chown lfs $LFS/sources</userinput></screen>
  64. <para>Next, login as user <emphasis>lfs</emphasis>. This can be done
  65. via a virtual console, through a display manager, or with the
  66. following substitute user command:</para>
  67. <screen><userinput>su - lfs</userinput></screen>
  68. <para>The <quote><parameter>-</parameter></quote> instructs
  69. <command>su</command> to start a login shell as opposed to a non-login
  70. shell. The difference between these two types of shells can be found
  71. in detail in the Bash man and info pages.</para>
  72. </sect1>