FreeKB - 0 Understanding the skeleton directory in Linux
Understanding the skeleton directory in Linux

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


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

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


Web design by yours truely - me, myself, and I   |   |