source: postlfs/config/skel.xml@ 76d61ba

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 76d61ba was 3597eb6, checked in by Randy McMurchy <randy@…>, 18 years ago

Added the 'User Notes' wiki link to each package page; changed all instances of .[so,a] to .{so,a} (brackets changed to braces); changed all replaceable tags to use angle brackets instead of square brackets to encapsulate the text - commit #7

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@5835 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 6.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/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>,
43 if it exists. If this file does not exist, then it uses some internal
44 defaults. You can see the default values by running
45 <command>/usr/sbin/useradd -D</command>.</para>
46
47 <para>To change these values to something new, create a base
48 <filename>/etc/default/useradd</filename> file as the
49 <systemitem class='username'>root</systemitem> user with the same values as
50 the output of <command>/usr/sbin/useradd -D</command>. Here is a
51 sample:</para>
52
53<screen><literal># Begin /etc/default/useradd
54
55GROUP=100
56HOME=/home
57INACTIVE=-1
58EXPIRE=
59SHELL=
60SKEL=/etc/skel
61
62# End /etc/default/useradd</literal></screen>
63
64 <para>The only thing missing from the file is a default shell. Add that
65 by running the following command as the
66 <systemitem class='username'>root</systemitem> user:</para>
67
68<screen role="root"><userinput>/usr/sbin/useradd -D -s/bin/bash</userinput></screen>
69
70 <para>This will set the <envar>SHELL</envar>= line to
71 <envar>SHELL</envar>=/bin/bash.</para>
72
73 <para><command>useradd</command> has many parameters that
74 can be set in the <filename>/etc/default/useradd</filename> file. For more
75 information see <command>man useradd</command>.</para>
76
77 <bridgehead renderas="sect5">/etc/skel</bridgehead>
78
79 <para>To get started, create an
80 <filename class="directory">/etc/skel</filename> directory and make sure it
81 is writable only by the system administrator, usually
82 <systemitem class="username">root</systemitem>. Creating the directory as
83 <systemitem class="username">root</systemitem> is the best way to go.</para>
84
85 <para>The mode of any files from this part of the book that you put in
86 <filename class="directory">/etc/skel</filename> should be writable only by
87 the owner. Also, since there is no telling what kind of sensitive information
88 a user may eventually place in their copy of these files, you should
89 make them unreadable by "group" and "other".</para>
90
91 <para>You can also put other files in
92 <filename class="directory">/etc/skel</filename> and
93 different permissions may be needed for them.</para>
94
95 <para>Decide which initialization files should be provided in every (or most)
96 new user's home directory. The decisions you make will affect what you
97 do in the next two sections, <xref linkend="postlfs-config-profile"/> and
98 <xref linkend="postlfs-config-vimrc"/>. Some or all of those files will be
99 useful for <systemitem class="username">root</systemitem>, any
100 already-existing users, and new users.</para>
101
102 <para>The files from those sections that you might want to place in
103 <filename class="directory">/etc/skel</filename> include
104 <filename>.inputrc</filename>, <filename>.bash_profile</filename>,
105 <filename>.bashrc</filename>, <filename>.bash_logout</filename>,
106 <filename>.dircolors</filename>, and <filename>.vimrc</filename>. If
107 you are unsure which of these should be placed there, just continue to
108 the following sections, read each section and any references provided,
109 and then make your decision.</para>
110
111 <para>You will run a slightly modified set of commands for files which
112 are placed in <filename class="directory">/etc/skel</filename>. Each section
113 will remind you of this. In brief, the book's commands have been written for
114 files <emphasis>not</emphasis> added to
115 <filename class="directory">/etc/skel</filename> and instead just sends the
116 results to the user's home directory. If the file is going to be in
117 <filename class="directory">/etc/skel</filename>, change the book's command(s)
118 to send output there instead and then just copy the file from
119 <filename class="directory">/etc/skel</filename> to the appropriate
120 directories, like <filename class="directory">/etc</filename>,
121 <filename class="directory">~</filename> or the home directory
122 of any other user already in the system.</para>
123
124 <bridgehead renderas="sect5">When Adding a User</bridgehead>
125
126 <para>When adding a new user with <command>useradd</command>, use
127 the <option>-m</option> parameter, which tells
128 <command>useradd</command> to create the user's home directory and
129 copy files from <filename class="directory">/etc/skel</filename> (can be
130 overridden) to the new user's home directory. For example (perform as the
131 <systemitem class="username">root</systemitem> user):</para>
132
133<screen role="root"><userinput>useradd -m <replaceable>&lt;newuser&gt;</replaceable></userinput></screen>
134
135</sect1>
Note: See TracBrowser for help on using the repository browser.