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">
8 <sect1 id="ch-tools-addinguser">
9 <?dbhtml filename="addinguser.html"?>
11 <title>Adding the LFS User</title>
13 <para>When logged in as user <systemitem class="username">root</systemitem>,
14 making a single mistake can damage or destroy a system. Therefore, we
15 recommend building the packages in this chapter as an unprivileged user.
16 You could use your own user name, but to make it easier to set up a clean
17 working environment, create a new user called <systemitem
18 class="username">lfs</systemitem> as a member of a new group (also named
19 <systemitem class="groupname">lfs</systemitem>) and use this user during
20 the installation process. As <systemitem class="username">root</systemitem>,
21 issue the following commands to add the new user:</para>
23 <screen><userinput>groupadd lfs
24 useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
27 <title>The meaning of the command line options:</title>
30 <term><parameter>-s /bin/bash</parameter></term>
32 <para>This makes <command>bash</command> the default shell for user
33 <systemitem class="username">lfs</systemitem>.</para>
38 <term><parameter>-g lfs</parameter></term>
40 <para>This option adds user <systemitem class="username">lfs</systemitem>
41 to group <systemitem class="groupname">lfs</systemitem>.</para>
46 <term><parameter>-m</parameter></term>
48 <para>This creates a home directory for <systemitem
49 class="username">lfs</systemitem>.</para>
54 <term><parameter>-k /dev/null</parameter></term>
56 <para>This parameter prevents possible copying of files from a skeleton
57 directory (default is <filename class="directory">/etc/skel</filename>)
58 by changing the input location to the special null device.</para>
63 <term><parameter>lfs</parameter></term>
65 <para>This is the actual name for the created group and user.</para>
71 <para>To log in as <systemitem class="username">lfs</systemitem> (as opposed
72 to switching to user <systemitem class="username">lfs</systemitem> when logged
73 in as <systemitem class="username">root</systemitem>, which does not require
74 the <systemitem class="username">lfs</systemitem> user to have a password),
75 give <systemitem class="username">lfs</systemitem> a password:</para>
77 <screen role="nodump"><userinput>passwd lfs</userinput></screen>
79 <para>Grant <systemitem class="username">lfs</systemitem> full access to
80 <filename class="directory">$LFS/tools</filename> by making
81 <systemitem class="username">lfs</systemitem> the directory owner:</para>
83 <screen><userinput>chown -v lfs $LFS/tools</userinput></screen>
85 <para>If a separate working directory was created as suggested, give
86 user <systemitem class="username">lfs</systemitem> ownership of this
89 <screen><userinput>chown -v lfs $LFS/sources</userinput></screen>
91 <para>Next, login as user <systemitem class="username">lfs</systemitem>.
92 This can be done via a virtual console, through a display manager, or with
93 the following substitute user command:</para>
95 <screen role="nodump"><userinput>su - lfs</userinput></screen>
97 <para>The <quote><parameter>-</parameter></quote> instructs
98 <command>su</command> to start a login shell as opposed to a non-login shell.
99 The difference between these two types of shells can be found in detail in
100 <filename>bash(1)</filename> and <command>info bash</command>.</para>