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