addinguser.xml 3.3 KB

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