[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" [
|
---|
[3f8be484] | 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 |
|
---|
[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>
|
---|
[3f8be484] | 36 | </listitem>
|
---|
| 37 | </varlistentry>
|
---|
| 38 |
|
---|
| 39 | <varlistentry>
|
---|
[95112ed] | 40 | <term><parameter>-g clfs</parameter></term>
|
---|
[3f8be484] | 41 | <listitem>
|
---|
[95112ed] | 42 | <para>This option adds user <systemitem class="username">clfs</systemitem>
|
---|
| 43 | to group <systemitem class="groupname">clfs</systemitem>.</para>
|
---|
[3f8be484] | 44 | </listitem>
|
---|
| 45 | </varlistentry>
|
---|
| 46 |
|
---|
| 47 | <varlistentry>
|
---|
| 48 | <term><parameter>-m</parameter></term>
|
---|
| 49 | <listitem>
|
---|
| 50 | <para>This creates a home directory for <systemitem
|
---|
[95112ed] | 51 | class="username">clfs</systemitem>.</para>
|
---|
[3f8be484] | 52 | </listitem>
|
---|
| 53 | </varlistentry>
|
---|
| 54 |
|
---|
| 55 | <varlistentry>
|
---|
| 56 | <term><parameter>-k /dev/null</parameter></term>
|
---|
| 57 | <listitem>
|
---|
| 58 | <para>This parameter prevents possible copying of files from a skeleton
|
---|
| 59 | directory (default is <filename class="directory">/etc/skel</filename>)
|
---|
| 60 | by changing the input location to the special null device.</para>
|
---|
| 61 | </listitem>
|
---|
| 62 | </varlistentry>
|
---|
| 63 |
|
---|
| 64 | <varlistentry>
|
---|
[95112ed] | 65 | <term><parameter>clfs</parameter></term>
|
---|
[3f8be484] | 66 | <listitem>
|
---|
| 67 | <para>This is the actual name for the created group and user.</para>
|
---|
| 68 | </listitem>
|
---|
| 69 | </varlistentry>
|
---|
| 70 |
|
---|
| 71 | </variablelist>
|
---|
| 72 |
|
---|
[95112ed] | 73 | <para>To log in as <systemitem class="username">clfs</systemitem> (as
|
---|
| 74 | opposed to switching to user <systemitem class="username">clfs</systemitem>
|
---|
[3f8be484] | 75 | when logged in as <systemitem class="username">root</systemitem>, which
|
---|
[95112ed] | 76 | does not require the <systemitem class="username">clfs</systemitem> user
|
---|
| 77 | to have a password), give <systemitem class="username">clfs</systemitem>
|
---|
[3f8be484] | 78 | a password:</para>
|
---|
| 79 |
|
---|
[95112ed] | 80 | <screen><userinput>passwd clfs</userinput></screen>
|
---|
[3f8be484] | 81 |
|
---|
[95112ed] | 82 | <para>Grant <systemitem class="username">clfs</systemitem> full access to
|
---|
[040521bc] | 83 | <filename class="directory">${CLFS}/cross-tools</filename> and
|
---|
| 84 | <filename class="directory">${CLFS}/tools</filename> by making <systemitem
|
---|
[95112ed] | 85 | class="username">clfs</systemitem> the directorys' owner:</para>
|
---|
[3f8be484] | 86 |
|
---|
[040521bc] | 87 | <screen><userinput>chown -v clfs ${CLFS}/tools
|
---|
| 88 | chown -v clfs ${CLFS}/cross-tools</userinput></screen>
|
---|
[3f8be484] | 89 |
|
---|
[8659630] | 90 | <para>If a separate working directory was created as suggested,
|
---|
[95112ed] | 91 | give user <systemitem class="username">clfs</systemitem> ownership of this directory:</para>
|
---|
[3f8be484] | 92 |
|
---|
[040521bc] | 93 | <screen><userinput>chown -v clfs ${CLFS}/sources</userinput></screen>
|
---|
[3f8be484] | 94 |
|
---|
[95112ed] | 95 | <para>Next, login as user <systemitem class="username">clfs</systemitem>.
|
---|
[3f8be484] | 96 | This can be done via a virtual console, through a display manager, or
|
---|
| 97 | with the following substitute user command:</para>
|
---|
| 98 |
|
---|
[95112ed] | 99 | <screen><userinput>su - clfs</userinput></screen>
|
---|
[3f8be484] | 100 |
|
---|
| 101 | <para>The <quote><parameter>-</parameter></quote> instructs
|
---|
| 102 | <command>su</command> to start a login shell as opposed to a non-login
|
---|
| 103 | shell. The difference between these two types of shells can be found
|
---|
| 104 | in detail in <filename>bash(1)</filename> and <command>info
|
---|
| 105 | bash</command>.</para>
|
---|
| 106 |
|
---|
| 107 | </sect1>
|
---|