How to create, modify, and delete user accounts in Linux

Home > Search > How-to
  by

The /etc/skel is a directory that contains files and directories. "skel" is short for Skeleton, and /etc/skel is commonly referred to as the Skeleton Directory. When creating a new user account using the useradd command, the /etc/skel directory contains files and directories that are copied to a new user's home directory. Typically, the files in /etc/skel are hidden, so the ls -a command must be used to view the files in /etc/skel.

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

 

Notice /etc/skel contains the following files:

  • .
  • ..
  • .bash_logout
  • .config
  • .mozilla
  • .profile

If we view a newly created users home directory, we can see that these files were copied to the users home directory.

[root@server1 ~]# ls -a /home/user1
. .. .bash_logout .config .mozilla .profile

 

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 user2, user2 home directory will contain directory ABC and file 123.

[user1@server1 ~]# useradd -m user2

[user1@server1 ~]# ls /home/user2
. .. 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 in the box below so that we can be sure you are a human.




Comments