source: clfs-embedded/BOOK/final-preps/addinguser.xml@ ccb1a8e

Last change on this file since ccb1a8e was 29214ff, checked in by Andrew Bradford <andrew@…>, 11 years ago

addinguser: Use sudo

Rather than logging in as root, it's just more convenient.

  • Property mode set to 100644
File size: 3.7 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/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
11 <title>Adding the CLFS User</title>
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
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
20 the installation process.</para>
21
22<screen><userinput>sudo groupadd clfs
23sudo useradd -s /bin/bash -g clfs -m -k /dev/null clfs</userinput></screen>
24
25 <variablelist>
26 <title>The meaning of the command line options:</title>
27
28 <varlistentry>
29 <term><parameter>-s /bin/bash</parameter></term>
30 <listitem>
31 <para>This makes <command>bash</command> the default shell for
32 user <systemitem class="username">clfs</systemitem>.</para>
33 </listitem>
34 </varlistentry>
35
36 <varlistentry>
37 <term><parameter>-g clfs</parameter></term>
38 <listitem>
39 <para>This option adds user <systemitem class="username">clfs</systemitem>
40 to group <systemitem class="groupname">clfs</systemitem>.</para>
41 </listitem>
42 </varlistentry>
43
44 <varlistentry>
45 <term><parameter>-m</parameter></term>
46 <listitem>
47 <para>This creates a home directory for <systemitem
48 class="username">clfs</systemitem>.</para>
49 </listitem>
50 </varlistentry>
51
52 <varlistentry>
53 <term><parameter>-k /dev/null</parameter></term>
54 <listitem>
55 <para>This parameter prevents possible copying of files from a skeleton
56 directory (default is <filename class="directory">/etc/skel</filename>)
57 by changing the input location to the special null device.</para>
58 </listitem>
59 </varlistentry>
60
61 <varlistentry>
62 <term><parameter>clfs</parameter></term>
63 <listitem>
64 <para>This is the actual name for the created group and user.</para>
65 </listitem>
66 </varlistentry>
67
68 </variablelist>
69
70 <para>To log in as <systemitem class="username">clfs</systemitem> (as
71 opposed to switching to user <systemitem class="username">clfs</systemitem>
72 when logged in as <systemitem class="username">root</systemitem>, which
73 does not require the <systemitem class="username">clfs</systemitem> user
74 to have a password), give <systemitem class="username">clfs</systemitem>
75 a password:</para>
76
77<screen><userinput>sudo passwd clfs</userinput></screen>
78
79 <para>Grant <systemitem class="username">clfs</systemitem> full access to
80 <filename class="directory">${CLFS}</filename> by making <systemitem
81 class="username">clfs</systemitem> the directory's owner:</para>
82
83<screen><userinput>sudo chown -Rv clfs ${CLFS}</userinput></screen>
84
85 <para>Next, login as user <systemitem class="username">clfs</systemitem>.
86 This can be done via a virtual console, through a display manager, or
87 with the following substitute user command:</para>
88
89<screen><userinput>su - clfs</userinput></screen>
90
91 <para>The <quote><parameter>-</parameter></quote> instructs
92 <command>su</command> to start a login shell as opposed to a non-login
93 shell. The difference between these two types of shells can be found
94 in detail in <filename>bash(1)</filename> and <command>info
95 bash</command>.</para>
96
97</sect1>
Note: See TracBrowser for help on using the repository browser.