[f8d632ac] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[6732c094] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[f8d632ac] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[0290a023] | 8 | <sect1 id="postlfs-config-skel" xreflabel="Configuring for Adding Users">
|
---|
[991aa6f] | 9 | <?dbhtml filename="skel.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info>
|
---|
| 12 | <date>$Date$</date>
|
---|
| 13 | </sect1info>
|
---|
| 14 |
|
---|
| 15 | <title>Configuring for Adding Users</title>
|
---|
| 16 |
|
---|
| 17 | <indexterm zone="postlfs-config-skel">
|
---|
| 18 | <primary sortas="e-etc-skel">/etc/skel/*</primary>
|
---|
| 19 | </indexterm>
|
---|
| 20 |
|
---|
| 21 | <indexterm zone="postlfs-config-skel">
|
---|
| 22 | <primary sortas="e-etc-default-useradd">/etc/default/useradd</primary>
|
---|
| 23 | </indexterm>
|
---|
| 24 |
|
---|
[81a73ed8] | 25 | <para>
|
---|
| 26 | Together, the <command>/usr/sbin/useradd</command> command and <filename
|
---|
| 27 | 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.
|
---|
| 33 | </para>
|
---|
| 34 |
|
---|
| 35 | <para>
|
---|
| 36 | The <filename class="directory">/etc/skel</filename> directory holds
|
---|
| 37 | copies of various initialization and other files that may be copied to the
|
---|
| 38 | new user's home directory when the <command>/usr/sbin/useradd</command>
|
---|
| 39 | program adds the new user.
|
---|
| 40 | </para>
|
---|
[991aa6f] | 41 |
|
---|
[cabf0e8] | 42 | <bridgehead renderas="sect5">Useradd</bridgehead>
|
---|
[991aa6f] | 43 |
|
---|
[81a73ed8] | 44 | <para>
|
---|
| 45 | The <command>useradd</command> program uses a collection of default
|
---|
| 46 | values kept in <filename>/etc/default/useradd</filename>. This file
|
---|
| 47 | is created in a base LFS installation by the
|
---|
| 48 | <application>Shadow</application> package. If it has been removed or
|
---|
| 49 | renamed, the <command>useradd</command> program uses some internal
|
---|
| 50 | defaults. You can see the default values by running
|
---|
| 51 | <command>/usr/sbin/useradd -D</command>.
|
---|
| 52 | </para>
|
---|
| 53 |
|
---|
| 54 | <para>
|
---|
| 55 | To change these values, simply modify the
|
---|
| 56 | <filename>/etc/default/useradd</filename> file as the
|
---|
| 57 | <systemitem class='username'>root</systemitem> user. An alternative to
|
---|
| 58 | directly modifying the file is to run <command>useradd</command> as the
|
---|
| 59 | <systemitem class='username'>root</systemitem> user while supplying the
|
---|
| 60 | desired modifications on the command line. Information on how to do this
|
---|
| 61 | can be found in the <command>useradd</command> man page.
|
---|
| 62 | </para>
|
---|
[991aa6f] | 63 |
|
---|
| 64 | <bridgehead renderas="sect5">/etc/skel</bridgehead>
|
---|
| 65 |
|
---|
[81a73ed8] | 66 | <para>
|
---|
| 67 | To get started, create an
|
---|
| 68 | <filename class="directory">/etc/skel</filename> directory and make sure it
|
---|
| 69 | is writable only by the system administrator, usually
|
---|
| 70 | <systemitem class="username">root</systemitem>. Creating the directory as
|
---|
| 71 | <systemitem class="username">root</systemitem> is the best way to go.
|
---|
| 72 | </para>
|
---|
| 73 |
|
---|
| 74 | <para>
|
---|
| 75 | The mode of any files from this part of the book that you put in <filename
|
---|
| 76 | class="directory">/etc/skel</filename> should be writable only by the
|
---|
| 77 | owner. Also, since there is no telling what kind of sensitive information
|
---|
| 78 | a user may eventually place in their copy of these files, you should
|
---|
| 79 | make them unreadable by "group" and "other".
|
---|
| 80 | </para>
|
---|
| 81 |
|
---|
| 82 | <para>
|
---|
| 83 | You can also put other files in
|
---|
| 84 | <filename class="directory">/etc/skel</filename> and
|
---|
| 85 | different permissions may be needed for them.
|
---|
| 86 | </para>
|
---|
| 87 |
|
---|
| 88 | <para>
|
---|
| 89 | Decide which initialization files should be provided in every (or most)
|
---|
| 90 | new user's home directory. The decisions you make will affect what you
|
---|
| 91 | do in the next two sections, <xref linkend="postlfs-config-profile"/> and
|
---|
| 92 | <xref linkend="postlfs-config-vimrc"/>. Some or all of those files will be
|
---|
| 93 | useful for <systemitem class="username">root</systemitem>, any
|
---|
| 94 | already-existing users, and new users.
|
---|
| 95 | </para>
|
---|
| 96 |
|
---|
| 97 | <para>
|
---|
| 98 | The files from those sections that you might want to place in
|
---|
| 99 | <filename class="directory">/etc/skel</filename> include
|
---|
| 100 | <filename>.inputrc</filename>, <filename>.bash_profile</filename>,
|
---|
| 101 | <filename>.bashrc</filename>, <filename>.bash_logout</filename>,
|
---|
| 102 | <filename>.dircolors</filename>, and <filename>.vimrc</filename>. If
|
---|
| 103 | you are unsure which of these should be placed there, just continue to
|
---|
| 104 | the following sections, read each section and any references provided,
|
---|
| 105 | and then make your decision.
|
---|
| 106 | </para>
|
---|
| 107 |
|
---|
| 108 | <para>
|
---|
| 109 | You will run a slightly modified set of commands for files which are
|
---|
| 110 | placed in <filename class="directory">/etc/skel</filename>. Each section
|
---|
| 111 | will remind you of this. In brief, the book's commands have been written
|
---|
| 112 | for files <emphasis>not</emphasis> added to <filename class="directory">
|
---|
| 113 | /etc/skel</filename> and instead just sends the results to the user's
|
---|
| 114 | home directory. If the file is going to be in <filename class="directory">
|
---|
| 115 | /etc/skel</filename>, change the book's command(s) to send output there
|
---|
| 116 | instead and then just copy the file from <filename class="directory">
|
---|
| 117 | /etc/skel</filename> to the appropriate directories, like <filename
|
---|
| 118 | class="directory">/etc</filename>, <filename class="directory">~
|
---|
| 119 | </filename> or the home directory of any other user already in the system.
|
---|
| 120 | </para>
|
---|
[991aa6f] | 121 |
|
---|
| 122 | <bridgehead renderas="sect5">When Adding a User</bridgehead>
|
---|
| 123 |
|
---|
[81a73ed8] | 124 | <para>
|
---|
| 125 | When adding a new user with <command>useradd</command>, use
|
---|
| 126 | the <option>-m</option> parameter, which tells
|
---|
| 127 | <command>useradd</command> to create the user's home directory and
|
---|
| 128 | copy files from <filename class="directory">/etc/skel</filename> (can be
|
---|
| 129 | overridden) to the new user's home directory. For example (perform as the
|
---|
| 130 | <systemitem class="username">root</systemitem> user):
|
---|
| 131 | </para>
|
---|
[991aa6f] | 132 |
|
---|
[3597eb6] | 133 | <screen role="root"><userinput>useradd -m <replaceable><newuser></replaceable></userinput></screen>
|
---|
[9a67723] | 134 |
|
---|
| 135 | </sect1>
|
---|