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