/etc/skel directory allows you to define default files and environment settings for every new user account. When you create a user with the -m flag, all contents of /etc/skel are copied into the new home directory—making it easy to enforce policies, defaults, and customizations.
Table of Common Skeleton Files
| File | Purpose | Description |
|---|---|---|
.bashrc | Shell configuration | Defines aliases, functions, and environment variables for interactive shells. |
.bash_profile | Login shell startup | Exports user-specific environment variables and initializes the login shell. |
README | Onboarding notice or policy document | Displays a default message or policy for every new user. |
1. Adding a Default README for All New Users
To inform new users about your site policy or housekeeping rules, place aREADME file in /etc/skel:
Files in
/etc/skel are only applied when a home directory is created (e.g., via useradd -m). Existing users are unaffected.2. Testing with a New User
Create a new user named trinity and verify that theREADME was copied:
3. Setting Up a Custom PATH for One User
If trinity needs access to tools in /opt/bin, prepend that directory to her PATH. Edit her .bashrc:
PATH line:
Always ensure each entry is separated by a colon (
:) and that $PATH remains at the end.4. Customizing the Default .bashrc for All New Users
To apply the same PATH change (or any other environment tweaks) site-wide, modify the skeleton .bashrc:
PATH definition—then save. Now, every new account created on this system will inherit these settings automatically.
Be careful when editing
/etc/skel/.bashrc. Errors in this file may prevent newly created users from logging in correctly.Now you’re ready to manage default user environments using
/etc/skel. Practice by adding more config files or policies to streamline onboarding for every new account!