/etc/skel directory.
skel
is derived from the skeleton because it contains the basic structure of the home directory. The /etc/skel
contains files and directories that are automatically copied over to a new user's home directory when such user is created by the useradd
program, thus making certain that all users begin with the same settings or environment.
Several user configuration files are placed in /etc/skel
by default when the operating system is installed. Typically they might include .bash_profile, .bashrc, .bash_logout, dircolors, .inputrc and .vimrc. The dots preceding the names of these files indicate that they are hidden files; files that are not normally visible in order to avoid visual clutter and help reduce the chances of accidental damage.
$ ls -la /etc/skel
rwxr-xr-x 128 root root 12288 Oct 2 12:58 ..
-rw-r--r-- 1 root root 220 Feb 25 2020 .bash_logout
-rw-r--r-- 1 root root 3771 Feb 25 2020 .bashrc
-rw-r--r-- 1 root root 807 Feb 25 2020 .profile
The location of /etc/skel
can be changed by editing the line that begins with SKEL= in the configuration file /etc/default/useradd
.
By default, SKEL= /etc/skel
$ cat /etc/default/useradd
# Default values for useradd(8)
SHELL=/bin/zsh
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes
Note that, the default permission of /etc/skel
is drwxr-xr-x.
It is also recommended not to change the permission of the skel
directory or its contents. Altering the permission will cause certain programs/profiles not to work as expected.