[02095ae] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="ch-final-preps-addinguser">
|
---|
| 9 | <?dbhtml filename="addinguser.html"?>
|
---|
| 10 |
|
---|
[586feb7] | 11 | <title>Adding the CLFS User</title>
|
---|
[02095ae] | 12 |
|
---|
| 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 as an unprivileged user.
|
---|
| 16 | You could use your own user name, but to make it easier to set up a clean
|
---|
| 17 | work environment, create a new user called <systemitem
|
---|
[586feb7] | 18 | class="username">clfs</systemitem> as a member of a new group (also named
|
---|
| 19 | <systemitem class="groupname">clfs</systemitem>) and use this user during
|
---|
[02095ae] | 20 | the installation process. As <systemitem class="username">root</systemitem>,
|
---|
| 21 | issue the following commands to add the new user:</para>
|
---|
| 22 |
|
---|
[586feb7] | 23 | <screen><userinput>groupadd clfs
|
---|
| 24 | useradd -s /bin/bash -g clfs -m -k /dev/null clfs</userinput></screen>
|
---|
[02095ae] | 25 |
|
---|
| 26 | <variablelist>
|
---|
| 27 | <title>The meaning of the command line options:</title>
|
---|
| 28 |
|
---|
| 29 | <varlistentry>
|
---|
| 30 | <term><parameter>-s /bin/bash</parameter></term>
|
---|
| 31 | <listitem>
|
---|
| 32 | <para>This makes <command>bash</command> the default shell for
|
---|
[586feb7] | 33 | user <systemitem class="username">clfs</systemitem>.</para>
|
---|
[02095ae] | 34 | </listitem>
|
---|
| 35 | </varlistentry>
|
---|
| 36 |
|
---|
| 37 | <varlistentry>
|
---|
[586feb7] | 38 | <term><parameter>-g clfs</parameter></term>
|
---|
[02095ae] | 39 | <listitem>
|
---|
[586feb7] | 40 | <para>This option adds user <systemitem class="username">clfs</systemitem>
|
---|
| 41 | to group <systemitem class="groupname">clfs</systemitem>.</para>
|
---|
[02095ae] | 42 | </listitem>
|
---|
| 43 | </varlistentry>
|
---|
| 44 |
|
---|
| 45 | <varlistentry>
|
---|
| 46 | <term><parameter>-m</parameter></term>
|
---|
| 47 | <listitem>
|
---|
| 48 | <para>This creates a home directory for <systemitem
|
---|
[586feb7] | 49 | class="username">clfs</systemitem>.</para>
|
---|
[02095ae] | 50 | </listitem>
|
---|
| 51 | </varlistentry>
|
---|
| 52 |
|
---|
| 53 | <varlistentry>
|
---|
| 54 | <term><parameter>-k /dev/null</parameter></term>
|
---|
| 55 | <listitem>
|
---|
| 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>
|
---|
| 59 | </listitem>
|
---|
| 60 | </varlistentry>
|
---|
| 61 |
|
---|
| 62 | <varlistentry>
|
---|
[1a09536] | 63 | <term><parameter>clfs</parameter></term>
|
---|
[02095ae] | 64 | <listitem>
|
---|
| 65 | <para>This is the actual name for the created group and user.</para>
|
---|
| 66 | </listitem>
|
---|
| 67 | </varlistentry>
|
---|
| 68 |
|
---|
| 69 | </variablelist>
|
---|
| 70 |
|
---|
[586feb7] | 71 | <para>To log in as <systemitem class="username">clfs</systemitem> (as
|
---|
| 72 | opposed to switching to user <systemitem class="username">clfs</systemitem>
|
---|
[02095ae] | 73 | when logged in as <systemitem class="username">root</systemitem>, which
|
---|
[586feb7] | 74 | does not require the <systemitem class="username">clfs</systemitem> user
|
---|
| 75 | to have a password), give <systemitem class="username">clfs</systemitem>
|
---|
[02095ae] | 76 | a password:</para>
|
---|
| 77 |
|
---|
[586feb7] | 78 | <screen><userinput>passwd clfs</userinput></screen>
|
---|
[02095ae] | 79 |
|
---|
[586feb7] | 80 | <para>Grant <systemitem class="username">clfs</systemitem> full access to
|
---|
| 81 | <filename class="directory">$CLFS</filename> by making <systemitem
|
---|
[1a09536] | 82 | class="username">clfs</systemitem> the directory's owner:</para>
|
---|
[02095ae] | 83 |
|
---|
[586feb7] | 84 | <screen><userinput>chown -Rv clfs $CLFS</userinput></screen>
|
---|
[02095ae] | 85 |
|
---|
[586feb7] | 86 | <para>Next, login as user <systemitem class="username">clfs</systemitem>.
|
---|
[02095ae] | 87 | This can be done via a virtual console, through a display manager, or
|
---|
| 88 | with the following substitute user command:</para>
|
---|
| 89 |
|
---|
[586feb7] | 90 | <screen><userinput>su - clfs</userinput></screen>
|
---|
[02095ae] | 91 |
|
---|
| 92 | <para>The <quote><parameter>-</parameter></quote> instructs
|
---|
| 93 | <command>su</command> to start a login shell as opposed to a non-login
|
---|
| 94 | shell. The difference between these two types of shells can be found
|
---|
| 95 | in detail in <filename>bash(1)</filename> and <command>info
|
---|
| 96 | bash</command>.</para>
|
---|
| 97 |
|
---|
| 98 | </sect1>
|
---|