/etc/skel

The /etc/skel directory is quite simple to setup and use. It provides a way to make sure that all new users on your LFS system begin with the same settings. The /etc/skel directory is used by the /usr/sbin/useradd program.

For more information see man useradd.

To get started create a /etc/skel directory. Creating the directory as root is the best way to go. Next copy any files into /etc/skel that you want every new user to have placed in their home drive. Examples include .bash_profile, .bashrc, .bash_logout, dircolors, .inputrc and .vimrc.

When creating a new user with /usr/sbin/useradd use the -m parameter. For example:

useradd -m -s/bin/bash jwrober

The /usr/sbin/useradd program uses a collection of default values. It will read them from the /etc/default/useradd file if it exists. If the file does not exist, then it uses some internal defaults. They can be found by running /usr/sbin/useradd -D.

To change these values to something new, create a base /etc/default/useradd file with the same values as the output of /usr/sbin/useradd -D. Here is a sample.

# Begin /etc/default/useradd

GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=
SKEL=/etc/skel

# End /etc/default/useradd

The only thing missing from the file is a default shell. Add that by running:

/usr/sbin/useradd -D -s/bin/bash

This will set the SHELL= line to SHELL=/bin/bash. This makes it even easier to add new users to your LFS system. The /usr/sbin/useradd has many parameters that can be set in the /etc/default/useradd file. See the man page for more details.