What is The /etc/skel directory In Linux

Last Updated on: 

The /etc/skel directory is useful in cases you would like to distribute default configuration files.

For example, if you have recommended settings for text editors you can add that to the directory, that way, anytime you add a new user and you have chosen to create a home directory while setting up the new user, the files that are contained within /etc/skel directory are copied into the home directory of the new user.

It doesn’t have to be a setting for text editors, it can be settings of about anything, from a welcome message, to making sure all new users on your system begin with the same configuration settings.

The skel is also known as the skeleton.

To see the contents of the /etc/skel directory, you can execute the command:

ls -la /etc/skel

This will display the default file that would be copied into the home directory whenever you create a new user and you’ve chosen to create a home directory for that user.

This is the output:

1. ls -la etc-skel

 

You would notice I use -la alongside the ls(list) command, the -a parameter helps in showing hidden files, as you can see: the .bash_logout, .bashrc, .profile begins with a period (which means they are hidden). The -l parameter is used to display a long list, this way, you can not only list it in a list format, but it would also display other info, e.g the owner of the file, date and so on.

That said, anytime you create a new user the .bash_logout, .bashrc, and .profile would be copied into their home directory.

Let’s create a dummy user as an example:

sudo adduser dummy

 Create new user to showcase the etc-skel

You can see the /etc/skel files is being copied into the new user home directory, let’s verify by changing directory to the user.

cd /home/dummy

and if you run ls -la , you would see the files have been copied into the user directory.

the etc-skel copied to new users directory

Hope you enjoyed the guide, see you some other time 😉

Comment policy: Respectful and beneficial comments are welcome with full open hands. However, all comments are manually moderated and those that doesn't relate with what the passage is saying or offensive comments would be deleted. Thanks for understanding!

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php