addinguser.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-preps-addinguser">
  8. <?dbhtml filename="addinguser.html"?>
  9. <title>Adding the LFS User</title>
  10. <para>When logged in as user <systemitem class="username">root</systemitem>,
  11. making a single mistake can damage or destroy a system. Therefore, we
  12. recommend building the packages in the next chapter as an unprivileged user.
  13. You could use your own user name, but to make it easier to set up a clean
  14. working environment, create a new user called <systemitem
  15. class="username">lfs</systemitem> as a member of a new group (also named
  16. <systemitem class="groupname">lfs</systemitem>) and use this user during
  17. the installation process. As <systemitem class="username">root</systemitem>,
  18. issue the following commands to add the new user:</para>
  19. <screen><userinput>groupadd lfs
  20. useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
  21. <variablelist>
  22. <title>The meaning of the command line options:</title>
  23. <varlistentry>
  24. <term><parameter>-s /bin/bash</parameter></term>
  25. <listitem>
  26. <para>This makes <command>bash</command> the default shell for user
  27. <systemitem class="username">lfs</systemitem>.</para>
  28. </listitem>
  29. </varlistentry>
  30. <varlistentry>
  31. <term><parameter>-g lfs</parameter></term>
  32. <listitem>
  33. <para>This option adds user <systemitem class="username">lfs</systemitem>
  34. to group <systemitem class="groupname">lfs</systemitem>.</para>
  35. </listitem>
  36. </varlistentry>
  37. <varlistentry>
  38. <term><parameter>-m</parameter></term>
  39. <listitem>
  40. <para>This creates a home directory for <systemitem
  41. class="username">lfs</systemitem>.</para>
  42. </listitem>
  43. </varlistentry>
  44. <varlistentry>
  45. <term><parameter>-k /dev/null</parameter></term>
  46. <listitem>
  47. <para>This parameter prevents possible copying of files from a skeleton
  48. directory (default is <filename class="directory">/etc/skel</filename>)
  49. by changing the input location to the special null device.</para>
  50. </listitem>
  51. </varlistentry>
  52. <varlistentry>
  53. <term><parameter>lfs</parameter></term>
  54. <listitem>
  55. <para>This is the actual name for the created group and user.</para>
  56. </listitem>
  57. </varlistentry>
  58. </variablelist>
  59. <para>To log in as <systemitem class="username">lfs</systemitem> (as opposed
  60. to switching to user <systemitem class="username">lfs</systemitem> when logged
  61. in as <systemitem class="username">root</systemitem>, which does not require
  62. the <systemitem class="username">lfs</systemitem> user to have a password),
  63. give <systemitem class="username">lfs</systemitem> a password:</para>
  64. <screen role="nodump"><userinput>passwd lfs</userinput></screen>
  65. <para>Grant <systemitem class="username">lfs</systemitem> full access to
  66. all directories under <filename class="directory">$LFS</filename> by making
  67. <systemitem class="username">lfs</systemitem> the directory owner:</para>
  68. <screen><userinput>chown -v lfs $LFS/{usr,lib,var,etc,bin,sbin,lib64,tools}</userinput></screen>
  69. <para>If a separate working directory was created as suggested, give
  70. user <systemitem class="username">lfs</systemitem> ownership of this
  71. directory:</para>
  72. <screen><userinput>chown -v lfs $LFS/sources</userinput></screen>
  73. <note><para>In some host systems, the following command does not complete
  74. properly and suspends the login to the lfs user to the background. If the
  75. prompt "lfs:~$" does not appear immediately, entering the
  76. <command>fg</command> command will fix the issue.</para></note>
  77. <para>Next, login as user <systemitem class="username">lfs</systemitem>.
  78. This can be done via a virtual console, through a display manager, or with
  79. the following substitute user command:</para>
  80. <screen role="nodump"><userinput>su - lfs</userinput></screen>
  81. <para>The <quote><parameter>-</parameter></quote> instructs
  82. <command>su</command> to start a login shell as opposed to a non-login shell.
  83. The difference between these two types of shells can be found in detail in
  84. <filename>bash(1)</filename> and <command>info bash</command>.</para>
  85. </sect1>