2004-05-03 11:59:46 +01:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2005-01-30 18:06:48 +00:00
|
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
2004-05-03 11:59:46 +01:00
|
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
]>
|
|
|
|
<sect1 id="ch-tools-addinguser">
|
2005-01-30 11:27:57 +00:00
|
|
|
<title>Adding the LFS User</title>
|
2004-05-03 11:59:46 +01:00
|
|
|
<?dbhtml filename="addinguser.html"?>
|
|
|
|
|
2005-06-29 17:24:16 +01:00
|
|
|
<para>When logged in as user <emphasis>root</emphasis>, making a single mistake
|
|
|
|
can damage or destroy a system. Therefore, we recommend building the packages in
|
|
|
|
this chapter as an unprivileged user. You could use your own user name, but to
|
|
|
|
make it easier to set up a clean working environment, create a new user called
|
|
|
|
<emphasis>lfs</emphasis> as a member of a new group (also named
|
|
|
|
<emphasis>lfs</emphasis>) and use this user during the installation process. As
|
2005-02-19 22:16:42 +00:00
|
|
|
<emphasis>root</emphasis>, issue the following commands to add the new
|
|
|
|
user:</para>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2004-06-19 21:48:04 +01:00
|
|
|
<screen><userinput>groupadd lfs
|
|
|
|
useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2005-02-19 22:16:42 +00:00
|
|
|
<para>The meaning of the command line options:</para>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>-s /bin/bash</parameter></term>
|
|
|
|
<listitem><para>This makes
|
|
|
|
<command>bash</command> the default shell for user
|
|
|
|
<emphasis>lfs</emphasis>.</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>-g lfs</parameter></term>
|
|
|
|
<listitem><para>This option adds user <emphasis>lfs</emphasis> to group
|
|
|
|
<emphasis>lfs</emphasis>.</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>-m</parameter></term>
|
|
|
|
<listitem><para>This creates a home
|
|
|
|
directory for <emphasis>lfs</emphasis>.</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>-k /dev/null</parameter></term>
|
|
|
|
<listitem><para>This parameter
|
|
|
|
prevents possible copying of files from a skeleton directory (default
|
|
|
|
is <filename class="directory">/etc/skel</filename>) by changing the input location to
|
|
|
|
the special null device.</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>lfs</parameter></term>
|
|
|
|
<listitem><para>This is the actual name for the created group and
|
|
|
|
user.</para></listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
<para>To log in as <emphasis>lfs</emphasis> (as opposed to switching
|
|
|
|
to user <emphasis>lfs</emphasis> when
|
|
|
|
logged in as <emphasis>root</emphasis>, which does not require the
|
|
|
|
<emphasis>lfs</emphasis> user to have a
|
|
|
|
password), give <emphasis>lfs</emphasis> a password:</para>
|
|
|
|
|
2005-09-12 00:30:56 +01:00
|
|
|
<screen role="nodump"><userinput>passwd lfs</userinput></screen>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2005-02-19 22:16:42 +00:00
|
|
|
<para>Grant <emphasis>lfs</emphasis> full access to
|
|
|
|
<filename class="directory">$LFS/tools</filename> by making
|
|
|
|
<emphasis>lfs</emphasis> the directory owner:</para>
|
|
|
|
|
2004-05-03 11:59:46 +01:00
|
|
|
<screen><userinput>chown lfs $LFS/tools</userinput></screen>
|
|
|
|
|
2005-02-19 22:16:42 +00:00
|
|
|
<para>If a separate working directory was created as suggested, give
|
|
|
|
user <emphasis>lfs</emphasis> ownership of this directory:</para>
|
|
|
|
|
2004-05-03 11:59:46 +01:00
|
|
|
<screen><userinput>chown lfs $LFS/sources</userinput></screen>
|
|
|
|
|
2005-02-19 22:16:42 +00:00
|
|
|
<para>Next, login as user <emphasis>lfs</emphasis>. This can be done
|
|
|
|
via a virtual console, through a display manager, or with the
|
|
|
|
following substitute user command:</para>
|
|
|
|
|
2004-05-03 11:59:46 +01:00
|
|
|
<screen><userinput>su - lfs</userinput></screen>
|
|
|
|
|
2005-02-19 22:16:42 +00:00
|
|
|
<para>The <quote><parameter>-</parameter></quote> instructs
|
2005-06-29 17:24:16 +01:00
|
|
|
<command>su</command> to start a login shell as opposed to a non-login shell.
|
2005-07-04 22:32:47 +01:00
|
|
|
The difference between these two types of shells can be found in detail in
|
|
|
|
<filename>bash(1)</filename> and <command>info bash</command>.</para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2004-05-03 11:59:46 +01:00
|
|
|
</sect1>
|
2005-02-19 22:16:42 +00:00
|
|
|
|