/etc/skel directory.
The name "skel" is derived from "skeleton," as it holds the fundamental structure of a user's home directory. This directory provides the essential files and configurations required for every new user, much like a skeletal framework provides a basic structure for an organism.
🎧
The /etc/skel
directory contains files and directories that are automatically copied into a new user's home directory when the user is created with tools like useradd
or adduser
. This ensures that all new user accounts start with the same default settings and environment configuration, providing a consistent setup across the system.
When the operating system is installed, several basic configuration files are typically placed in /etc/skel
by default. These might include .bash_profile, .bashrc, .bash_logout, dircolors, .inputrc, and .vimrc. Each of these files serves a specific purpose; for example, .bashrc contains settings for the Bash shell, while .vimrc configures options for the Vim text editor.
The dot (.) before the filenames denotes that these are hidden files, meaning they won't appear with a standard directory listing and help keep users' home directories organized and free of unnecessary clutter. This also helps reduce the chances of accidental changes to important configuration files. System administrators can customize files within /etc/skel
to ensure a tailored environment for all future users on the system, adapting it to specific organizational needs or preferences.
See below:
$ 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 modified by adjusting the SKEL= line in the /etc/default/useradd
configuration file.
By default, this line is set to SKEL=/etc/skel
.
See below:
$ 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
By default, the permissions for /etc/skel
are set to drwxr-xr-x, which allows read and execute access for all users but restricts write access to the owner. It's generally advised not to modify these permissions or those of the contents within /etc/skel
, as doing so could interfere with expected behavior in certain programs or user profiles, potentially leading to issues with default settings for new user accounts.
Thanks for checking in, and we hope this was helpful!