What is the /etc/skel directory in Linux?

In this article, you will learn about What is the /etc/skel directory in Linux?

The /etc/skel directory contains files and directories that are automatically copied over to a new user’s home directory when such a user is created by the useradd program. skel is derived from the “skeleton”. Below is shown a picture.

skel directory in Linux
files in skel directory

Note:skeleton” directory is define in /etc/default/useradd file

Below you can see the picture of /etc/default/useradd file which defines the skel directory. You can change the default location /etc/skel to any other location.

cat /etc/default/useradd
etc_default_useraddskel
etc/default/useradd format
# useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

You can also change the default base /home directory to any other location. For Example (HOME=/home, you can change the location to any other location like /file/home you need to change the value HOME=/file/home)

Changing the default user home location 

If you want to change the default home location of the user then you have to edit useradd file using any editors. For example, I’m using here vim editors.

vim /etc/default/useradd

And change the default value from /home to the consider home location. For example, if you want to change it /data/userhome then you just need to type.

HOME=/data/userhome

When you create any new users, then the new users’ home will be /data/userhome.

Default permission of /etc/skel directory

The default permission of /etc/skel directory is drwxr-xr-x.

It is not recommended to change the permission of the skel directory or its contents. Changing the permission may break some of the programs because in the skel directory some profiles need the permission of ‘read’ and trying to permit it to execute will cause some programs/profiles to work unexpectedly.

Conclusion

In this tutorial, we learn about the /etc/skel directory in Linux. I hope, you understand, but if you have any questions, you can ask in the comment section.

You can read about

Leave a Reply