[3f8be484] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[aa18ac0] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[01817d3] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
[3f8be484] | 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="ch-final-preps-addinguser">
|
---|
| 9 | <?dbhtml filename="addinguser.html"?>
|
---|
| 10 |
|
---|
[95112ed] | 11 | <title>Adding the CLFS User</title>
|
---|
[3f8be484] | 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
|
---|
[95112ed] | 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
|
---|
[3f8be484] | 20 | the installation process. As <systemitem class="username">root</systemitem>,
|
---|
| 21 | issue the following commands to add the new user:</para>
|
---|
| 22 |
|
---|
[95112ed] | 23 | <screen><userinput>groupadd clfs
|
---|
[a4b892f] | 24 | useradd -s /bin/bash -g clfs -d /home/clfs clfs
|
---|
| 25 | mkdir -pv /home/clfs
|
---|
| 26 | chown -v clfs:clfs /home/clfs</userinput></screen>
|
---|
[3f8be484] | 27 |
|
---|
| 28 | <variablelist>
|
---|
| 29 | <title>The meaning of the command line options:</title>
|
---|
| 30 |
|
---|
| 31 | <varlistentry>
|
---|
| 32 | <term><parameter>-s /bin/bash</parameter></term>
|
---|
| 33 | <listitem>
|
---|
| 34 | <para>This makes <command>bash</command> the default shell for
|
---|
[95112ed] | 35 | user <systemitem class="username">clfs</systemitem>.</para>
|
---|
[a1ffe3e] | 36 |
|
---|
| 37 | <important>
|
---|
| 38 | <para>The build instructions assume that the <command>bash</command>
|
---|
| 39 | shell is in use.</para>
|
---|
| 40 | </important>
|
---|
| 41 |
|
---|
[3f8be484] | 42 | </listitem>
|
---|
| 43 | </varlistentry>
|
---|
| 44 |
|
---|
| 45 | <varlistentry>
|
---|
[95112ed] | 46 | <term><parameter>-g clfs</parameter></term>
|
---|
[3f8be484] | 47 | <listitem>
|
---|
[fa9b711] | 48 | <para>This option adds the new user to the
|
---|
| 49 | <systemitem class="groupname">clfs</systemitem> group.</para>
|
---|
| 50 | </listitem>
|
---|
| 51 | </varlistentry>
|
---|
| 52 |
|
---|
| 53 | <varlistentry>
|
---|
| 54 | <term><parameter>-d /home/clfs</parameter></term>
|
---|
| 55 | <listitem>
|
---|
| 56 | <para>This option sets the user's home directory, but does not create
|
---|
| 57 | it. We could have used <option>-m</option> to tell
|
---|
| 58 | <command>useradd</command> to create the directory as well, but this
|
---|
| 59 | would also copy whatever is in the host system's
|
---|
| 60 | <filename class="directory">/etc/skel</filename> directory into the new
|
---|
| 61 | user's home. We would prefer to have a clean user environment, so we
|
---|
| 62 | just create an empty directory after adding the user.</para>
|
---|
[3f8be484] | 63 | </listitem>
|
---|
| 64 | </varlistentry>
|
---|
| 65 |
|
---|
| 66 | <varlistentry>
|
---|
[95112ed] | 67 | <term><parameter>clfs</parameter></term>
|
---|
[3f8be484] | 68 | <listitem>
|
---|
| 69 | <para>This is the actual name for the created group and user.</para>
|
---|
| 70 | </listitem>
|
---|
| 71 | </varlistentry>
|
---|
| 72 |
|
---|
| 73 | </variablelist>
|
---|
| 74 |
|
---|
[95112ed] | 75 | <para>To log in as <systemitem class="username">clfs</systemitem> (as
|
---|
| 76 | opposed to switching to user <systemitem class="username">clfs</systemitem>
|
---|
[3f8be484] | 77 | when logged in as <systemitem class="username">root</systemitem>, which
|
---|
[95112ed] | 78 | does not require the <systemitem class="username">clfs</systemitem> user
|
---|
| 79 | to have a password), give <systemitem class="username">clfs</systemitem>
|
---|
[3f8be484] | 80 | a password:</para>
|
---|
| 81 |
|
---|
[95112ed] | 82 | <screen><userinput>passwd clfs</userinput></screen>
|
---|
[3f8be484] | 83 |
|
---|
[95112ed] | 84 | <para>Grant <systemitem class="username">clfs</systemitem> full access to
|
---|
[040521bc] | 85 | <filename class="directory">${CLFS}/cross-tools</filename> and
|
---|
| 86 | <filename class="directory">${CLFS}/tools</filename> by making <systemitem
|
---|
[95112ed] | 87 | class="username">clfs</systemitem> the directorys' owner:</para>
|
---|
[3f8be484] | 88 |
|
---|
[040521bc] | 89 | <screen><userinput>chown -v clfs ${CLFS}/tools
|
---|
| 90 | chown -v clfs ${CLFS}/cross-tools</userinput></screen>
|
---|
[3f8be484] | 91 |
|
---|
[24b004c] | 92 | <para>If a separate working directory was created as suggested,
|
---|
[95112ed] | 93 | give user <systemitem class="username">clfs</systemitem> ownership of this directory:</para>
|
---|
[3f8be484] | 94 |
|
---|
[040521bc] | 95 | <screen><userinput>chown -v clfs ${CLFS}/sources</userinput></screen>
|
---|
[3f8be484] | 96 |
|
---|
[95112ed] | 97 | <para>Next, login as user <systemitem class="username">clfs</systemitem>.
|
---|
[3f8be484] | 98 | This can be done via a virtual console, through a display manager, or
|
---|
| 99 | with the following substitute user command:</para>
|
---|
| 100 |
|
---|
[95112ed] | 101 | <screen><userinput>su - clfs</userinput></screen>
|
---|
[3f8be484] | 102 |
|
---|
| 103 | <para>The <quote><parameter>-</parameter></quote> instructs
|
---|
| 104 | <command>su</command> to start a login shell as opposed to a non-login
|
---|
| 105 | shell. The difference between these two types of shells can be found
|
---|
| 106 | in detail in <filename>bash(1)</filename> and <command>info
|
---|
| 107 | bash</command>.</para>
|
---|
| 108 |
|
---|
[a1ffe3e] | 109 | <note>
|
---|
| 110 | <para>Until specified otherwise, all commands from this point on
|
---|
| 111 | should be done as the <systemitem class="username">clfs</systemitem>
|
---|
| 112 | user.</para>
|
---|
| 113 | </note>
|
---|
| 114 |
|
---|
[3f8be484] | 115 | </sect1>
|
---|