[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 | <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
|
---|
[e0d33ef] | 27 | <filename class="directory">/etc/skel</filename> directory (both are easy to
|
---|
[9e4bed20] | 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>
|
---|
[991aa6f] | 33 |
|
---|
[e0d33ef] | 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
|
---|
[d612b9f] | 36 | new user's home directory when the <command>/usr/sbin/useradd</command>
|
---|
[991aa6f] | 37 | program adds the new user.</para>
|
---|
| 38 |
|
---|
[cabf0e8] | 39 | <bridgehead renderas="sect5">Useradd</bridgehead>
|
---|
[991aa6f] | 40 |
|
---|
| 41 | <para>The <command>useradd</command> program uses a collection of
|
---|
[cabf0e8] | 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
|
---|
[991aa6f] | 47 | <command>/usr/sbin/useradd -D</command>.</para>
|
---|
| 48 |
|
---|
[cabf0e8] | 49 | <para>To change these values, simply modify the
|
---|
[9e4bed20] | 50 | <filename>/etc/default/useradd</filename> file as the
|
---|
[cabf0e8] | 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>
|
---|
[991aa6f] | 56 |
|
---|
| 57 | <bridgehead renderas="sect5">/etc/skel</bridgehead>
|
---|
| 58 |
|
---|
[9e4bed20] | 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>
|
---|
[991aa6f] | 64 |
|
---|
| 65 | <para>The mode of any files from this part of the book that you put in
|
---|
[e0d33ef] | 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
|
---|
[991aa6f] | 68 | a user may eventually place in their copy of these files, you should
|
---|
| 69 | make them unreadable by "group" and "other".</para>
|
---|
| 70 |
|
---|
[e0d33ef] | 71 | <para>You can also put other files in
|
---|
[991aa6f] | 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
|
---|
[e0d33ef] | 77 | do in the next two sections, <xref linkend="postlfs-config-profile"/> and
|
---|
[991aa6f] | 78 | <xref linkend="postlfs-config-vimrc"/>. Some or all of those files will be
|
---|
[e0d33ef] | 79 | useful for <systemitem class="username">root</systemitem>, any
|
---|
[991aa6f] | 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
|
---|
[e0d33ef] | 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
|
---|
[9e4bed20] | 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
|
---|
[e0d33ef] | 97 | <filename class="directory">/etc/skel</filename>, change the book's command(s)
|
---|
[991aa6f] | 98 | to send output there instead and then just copy the file from
|
---|
[e0d33ef] | 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
|
---|
[991aa6f] | 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
|
---|
[e0d33ef] | 109 | copy files from <filename class="directory">/etc/skel</filename> (can be
|
---|
[9e4bed20] | 110 | overridden) to the new user's home directory. For example (perform as the
|
---|
| 111 | <systemitem class="username">root</systemitem> user):</para>
|
---|
[991aa6f] | 112 |
|
---|
[3597eb6] | 113 | <screen role="root"><userinput>useradd -m <replaceable><newuser></replaceable></userinput></screen>
|
---|
[9a67723] | 114 |
|
---|
| 115 | </sect1>
|
---|