/etc/skel directory in Linux

In this article, we would discuss /etc/skel directory in Linux distributions. The /etc/skel/ contains all the files and directories which are automatically copied to the newly created user’s home directory.

In an organization, a System Administrator has to manage large pool of users. It wouldn’t be feasible for the System Administrator to make similar changes for each user who joins the organization. For example, If the System Administrator wants to provide a specific file to all the newly created users. Then, he/she has to copy that file for each user. Or, the System Administrator may copy the file in the /etc/skel/ directory. And, it copies the file on its own whenever System Administrator creates a new user. Thus, the System Administrator can save himself/herself valuable chunks of time.

/etc/skel directory in Linux

To know the contents of your system’s /etc/skel/ directory run the following command in terminal –

ls -al /etc/skel/

here,

-a option – to list hidden files in the directory, and

-l is for long list format.

The output would correspond with –

etc skel

As visible from the output, the root has the ownership of all files and directories in /etc/skel/ directory. When adding a user through useradd command, we don’t have to worry about ownership of contents as appropriate permissions are automatically set.

Although not advisable, if we wish to change the default /etc/skel/ directory then we can do so by editing the /etc/default/useradd file. Open the file as superuser and move to the entry that mentions SKEL=/etc/skel. Thereafter, we have to enter the directory’s address of our choice in place of /etc/skel/. There are few other changes we can make by editing /etc/default/useradd file. But, we should avoid it unless absolutely required.

In conclusion, /etc/skel/ directory in Linux- is a skeleton directory which contains the default files that would automatically get copied to newly created users’ HOME directory.

Similar Posts