Bootstrap FreeKB - Linux Fundamentals - Understanding the skeleton directory in Linux
Linux Fundamentals - Understanding the skeleton directory in Linux

Updated:   |  Linux Fundamentals articles

The skeleton directory is located at /etc/skel. The contents of the skeleton directory are hidden, so the -a option is needed with the LS command to view the contents of the skeleton directory.

[user1@server1 ~]# ls -a /etc/skel
. .. .bash_logout  .bash_profile  .config  .mozilla

 

The files listed in the skeleton directory are what will appear in the users home directory. For example, let's say a user account is created for user2 using the useradd command.

[user1@server1 ~]# useradd -m user2

 

In this case, /home/user2 would contain the files listed in the skeleton directory.

[user1@server1 ~]# ls -a /home/user2
. .. .bash_logout  .bash_profile  .bashrc  .emacs  .kshrc  .mozilla

 

Let's say you want every new user account to contain a directory name ABC and a file named 123. You can create these files in the skeleton directory.

[user1@server1 ~]# mkdir /etc/skel/ABC
[user1@server1 ~]# touch /etc/skel/123

 

When you create user3, user3 home directory will contain directory ABC and file 123.

[user1@server1 ~]# useradd -m user3

[user1@server1 ~]# ls /home/user3
. .. ABC 123 .bash_logout  .bash_profile  .bashrc  .emacs  .kshrc  .mozilla

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 49b74a in the box below so that we can be sure you are a human.