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="postlfs-config-skel" xreflabel="Configuring for Adding Users">
|
---|
9 | <?dbhtml filename="skel.html"?>
|
---|
10 |
|
---|
11 | <sect1info>
|
---|
12 | <othername>$LastChangedBy$</othername>
|
---|
13 | <date>$Date$</date>
|
---|
14 | </sect1info>
|
---|
15 |
|
---|
16 | <title>Configuring for Adding Users</title>
|
---|
17 |
|
---|
18 | <indexterm zone="postlfs-config-skel">
|
---|
19 | <primary sortas="e-etc-skel">/etc/skel/*</primary>
|
---|
20 | </indexterm>
|
---|
21 |
|
---|
22 | <indexterm zone="postlfs-config-skel">
|
---|
23 | <primary sortas="e-etc-default-useradd">/etc/default/useradd</primary>
|
---|
24 | </indexterm>
|
---|
25 |
|
---|
26 | <para>Together, the <command>/usr/sbin/useradd</command> command and
|
---|
27 | <filename class="directory">/etc/skel</filename> directory (both are easy to
|
---|
28 | set up and use) provide a way to assure new users are added to your LFS
|
---|
29 | system with the same beginning settings for things such as the
|
---|
30 | <envar>PATH</envar>, keyboard processing and other environmental variables.
|
---|
31 | Using these two facilities makes it easier to assure this initial state for
|
---|
32 | each new user added to the system.</para>
|
---|
33 |
|
---|
34 | <para>The <filename class="directory">/etc/skel</filename> directory holds
|
---|
35 | copies of various initialization and other files that may be copied to the
|
---|
36 | new user's home directory when the <command>/usr/sbin/useradd</command>
|
---|
37 | program adds the new user.</para>
|
---|
38 |
|
---|
39 | <bridgehead renderas="sect5">Useradd</bridgehead>
|
---|
40 |
|
---|
41 | <para>The <command>useradd</command> program uses a collection of
|
---|
42 | default values kept in <filename>/etc/default/useradd</filename>. This file
|
---|
43 | is created in a base LFS installation by the
|
---|
44 | <application>Shadow</application> package. If it has been removed or renamed,
|
---|
45 | the <command>useradd</command> program uses some internal defaults. You can
|
---|
46 | see the default values by running
|
---|
47 | <command>/usr/sbin/useradd -D</command>.</para>
|
---|
48 |
|
---|
49 | <para>To change these values, simply modify the
|
---|
50 | <filename>/etc/default/useradd</filename> file as the
|
---|
51 | <systemitem class='username'>root</systemitem> user. An alternative to
|
---|
52 | directly modifying the file is to run <command>useradd</command> as the
|
---|
53 | <systemitem class='username'>root</systemitem> user while supplying the
|
---|
54 | desired modifications on the command line. Information on how to do this
|
---|
55 | can be found in the <command>useradd</command> man page.</para>
|
---|
56 |
|
---|
57 | <bridgehead renderas="sect5">/etc/skel</bridgehead>
|
---|
58 |
|
---|
59 | <para>To get started, create an
|
---|
60 | <filename class="directory">/etc/skel</filename> directory and make sure it
|
---|
61 | is writable only by the system administrator, usually
|
---|
62 | <systemitem class="username">root</systemitem>. Creating the directory as
|
---|
63 | <systemitem class="username">root</systemitem> is the best way to go.</para>
|
---|
64 |
|
---|
65 | <para>The mode of any files from this part of the book that you put in
|
---|
66 | <filename class="directory">/etc/skel</filename> should be writable only by
|
---|
67 | the owner. Also, since there is no telling what kind of sensitive information
|
---|
68 | a user may eventually place in their copy of these files, you should
|
---|
69 | make them unreadable by "group" and "other".</para>
|
---|
70 |
|
---|
71 | <para>You can also put other files in
|
---|
72 | <filename class="directory">/etc/skel</filename> and
|
---|
73 | different permissions may be needed for them.</para>
|
---|
74 |
|
---|
75 | <para>Decide which initialization files should be provided in every (or most)
|
---|
76 | new user's home directory. The decisions you make will affect what you
|
---|
77 | do in the next two sections, <xref linkend="postlfs-config-profile"/> and
|
---|
78 | <xref linkend="postlfs-config-vimrc"/>. Some or all of those files will be
|
---|
79 | useful for <systemitem class="username">root</systemitem>, any
|
---|
80 | already-existing users, and new users.</para>
|
---|
81 |
|
---|
82 | <para>The files from those sections that you might want to place in
|
---|
83 | <filename class="directory">/etc/skel</filename> include
|
---|
84 | <filename>.inputrc</filename>, <filename>.bash_profile</filename>,
|
---|
85 | <filename>.bashrc</filename>, <filename>.bash_logout</filename>,
|
---|
86 | <filename>.dircolors</filename>, and <filename>.vimrc</filename>. If
|
---|
87 | you are unsure which of these should be placed there, just continue to
|
---|
88 | the following sections, read each section and any references provided,
|
---|
89 | and then make your decision.</para>
|
---|
90 |
|
---|
91 | <para>You will run a slightly modified set of commands for files which
|
---|
92 | are placed in <filename class="directory">/etc/skel</filename>. Each section
|
---|
93 | will remind you of this. In brief, the book's commands have been written for
|
---|
94 | files <emphasis>not</emphasis> added to
|
---|
95 | <filename class="directory">/etc/skel</filename> and instead just sends the
|
---|
96 | results to the user's home directory. If the file is going to be in
|
---|
97 | <filename class="directory">/etc/skel</filename>, change the book's command(s)
|
---|
98 | to send output there instead and then just copy the file from
|
---|
99 | <filename class="directory">/etc/skel</filename> to the appropriate
|
---|
100 | directories, like <filename class="directory">/etc</filename>,
|
---|
101 | <filename class="directory">~</filename> or the home directory
|
---|
102 | of any other user already in the system.</para>
|
---|
103 |
|
---|
104 | <bridgehead renderas="sect5">When Adding a User</bridgehead>
|
---|
105 |
|
---|
106 | <para>When adding a new user with <command>useradd</command>, use
|
---|
107 | the <option>-m</option> parameter, which tells
|
---|
108 | <command>useradd</command> to create the user's home directory and
|
---|
109 | copy files from <filename class="directory">/etc/skel</filename> (can be
|
---|
110 | overridden) to the new user's home directory. For example (perform as the
|
---|
111 | <systemitem class="username">root</systemitem> user):</para>
|
---|
112 |
|
---|
113 | <screen role="root"><userinput>useradd -m <replaceable><newuser></replaceable></userinput></screen>
|
---|
114 |
|
---|
115 | </sect1>
|
---|