Distributing default configuration files with /etc/skel
In a typical organization, there are usually some defaults that are recommended for users in terms of files and configuration. For example, in a company that performs software development, there are likely recommended settings for text editors and version control systems. Files that are contained within /etc/skel
are copied into the home
directory for all new users when you create them (assuming you've chosen to create a home
directory while setting up the user).
In fact, you can see this for yourself right now. If you execute the following command, you can view the contents of the /etc/skel
directory:
ls -la /etc/skel
You probably already know how to list files within a directory, but I specifically called out the -a
parameter because the files included in /etc/skel
by default are hidden (their file names begin with a period). I threw the -l
parameter solely because I like it better (it shows a long list, which I think is easier to read). Your output will likely include the following files:
.bash_logout .bashrc .profile
Each time you create a new user and request a home
directory to be created as well, these three files will be copied into their home
directory, along with any other files you create here. You can verify this by listing the storage of the home
directories for the users you've created so far. The .bashrc
file in one user's home
directory should be the same as any other, unless they've made changes to it.
Armed with this knowledge, it should be extremely easy to create default files for new users you create. For example, you could create a file named welcome
with your favorite text editor and place it in /etc/skel
. Perhaps you may create this file to contain helpful phone numbers and information for new hires in your company. The file would then be automatically copied to the new user's home
directory when you create the account. The user, after logging in, would see this file in his or her home
directory and see the information. More practically, if your company has specific editor settings you favor for writing code, you can include those files in /etc/skel
as well to help ensure your users are compliant. In fact, you can include default configuration files for any application your company uses.
Go ahead and give it a try. Feel free to create some random text files and then create a new user afterwards, and you'll see that these files will propagate into the home directories of new user accounts you add to your system.