[9a67723] | 1 | <sect1 id="postlfs-config-skel">
|
---|
| 2 | <?dbhtml filename="skel.html" dir="postlfs"?>
|
---|
| 3 | <title>/etc/skel</title>
|
---|
| 4 |
|
---|
[7346f16] | 5 | <para>The <filename>/etc/skel</filename> directory is quite simple
|
---|
| 6 | to setup and use. It provides a way to make sure that all new users on
|
---|
| 7 | your LFS system begin with the same settings. The
|
---|
| 8 | <filename>/etc/skel</filename> directory is used by the
|
---|
| 9 | <filename>/usr/sbin/useradd</filename> program.</para>
|
---|
[9a67723] | 10 |
|
---|
[01600b9] | 11 | <para>For more information see <userinput>man useradd</userinput>.</para>
|
---|
[7346f16] | 12 |
|
---|
| 13 | <para>To get started create a <filename>/etc/skel</filename> directory.
|
---|
| 14 | Creating the directory as root is the best way to go. Next copy any
|
---|
| 15 | files into <filename>/etc/skel</filename> that you want every new user
|
---|
| 16 | to have placed in their home drive. Examples include
|
---|
| 17 | <filename>.bash_profile</filename>, <filename>.bashrc</filename>,
|
---|
| 18 | <filename>.bash_logout</filename>, <filename>dircolors</filename>,
|
---|
[8a0cee4] | 19 | <filename>.inputrc</filename> and <filename>.vimrc</filename>.</para>
|
---|
[7346f16] | 20 |
|
---|
| 21 | <para>When creating a new user with
|
---|
| 22 | <filename>/usr/sbin/useradd</filename> use the <userinput>-m</userinput>
|
---|
| 23 | parameter. For example:</para>
|
---|
| 24 |
|
---|
[01600b9] | 25 | <para><screen><userinput>useradd -m -s/bin/bash jwrober</userinput></screen></para>
|
---|
[7346f16] | 26 |
|
---|
| 27 | <para>The <filename>/usr/sbin/useradd</filename> program uses a
|
---|
| 28 | collection of default values. It will read them from the
|
---|
| 29 | <filename>/etc/default/useradd</filename> file if it exists. If the
|
---|
| 30 | file does not exist, then it uses some internal defaults. They can be
|
---|
| 31 | found by running <userinput>/usr/sbin/useradd -D</userinput>.</para>
|
---|
| 32 |
|
---|
| 33 | <para>To change these values to something new, create a base
|
---|
| 34 | <filename>/etc/default/useradd</filename> file with the same values as
|
---|
| 35 | the output of <userinput>/usr/sbin/useradd -D</userinput>. Here is a
|
---|
| 36 | sample.</para>
|
---|
| 37 |
|
---|
| 38 | <para><screen># Begin /etc/default/useradd
|
---|
| 39 |
|
---|
| 40 | GROUP=100
|
---|
| 41 | HOME=/home
|
---|
| 42 | INACTIVE=-1
|
---|
| 43 | EXPIRE=
|
---|
| 44 | SHELL=
|
---|
| 45 | SKEL=/etc/skel
|
---|
| 46 |
|
---|
| 47 | # End /etc/default/useradd</screen></para>
|
---|
| 48 |
|
---|
| 49 | <para>The only thing missing from the file is a default shell. Add that
|
---|
| 50 | by running:</para>
|
---|
| 51 |
|
---|
[5e1c345] | 52 | <para><screen><userinput>/usr/sbin/useradd -D -s/bin/bash</userinput></screen></para>
|
---|
[7346f16] | 53 |
|
---|
| 54 | <para>This will set the <userinput>SHELL=</userinput> line to
|
---|
| 55 | <userinput>SHELL=/bin/bash</userinput>. This makes it even easier to
|
---|
| 56 | add new users to your LFS system. The
|
---|
| 57 | <filename>/usr/sbin/useradd</filename> has many parameters that can be
|
---|
| 58 | set in the <filename>/etc/default/useradd</filename> file. See the man
|
---|
| 59 | page for more details.</para>
|
---|
[9a67723] | 60 |
|
---|
| 61 | </sect1>
|
---|