Linux System Administration

0 of 84 lessons complete (0%)

Managing User Accounts

/etc/skel – Default User Environment

You don’t have access to this lesson

Please register or sign in to access the course content.

/etc/skel – Default User Environment

/etc/skel Directory

Creating a Default Environment for New Users

📁 What is /etc/skel?

The /etc/skel directory (short for “skeleton”) contains default files and configuration settings that are automatically copied to a new user’s home directory when the account is created.

🧱 Common Files in /etc/skel

  • .bashrc ô Shell settings and aliases
  • .profile ô Environment variables and login setup
  • .bash_logout ô Commands executed on logout
  • Any custom files (e.g., README.txt, .vimrc)

≡ƒ¢∩╕Å Example: Customizing New Users

Suppose you want all new users to see a welcome message and have helpful aliases:

# Create a message file
sudo nano /etc/skel/README.txt

# Edit .bashrc in /etc/skel
sudo nano /etc/skel/.bashrc

# Add aliases at the end
alias ll='ls -alF'
alias gs='git status'
   

👤 Create a New User

sudo useradd -m -s /bin/bash alice
sudo passwd alice
   

After this, /home/alice will include all files from /etc/skel by default!

£à Benefits

  • Standardized user setup
  • Saves admin time
  • Onboarding and guidance for new users
/etc/skel Example Output

🧪 /etc/skel Practical Example

Terminal Output Simulation for New User Setup

🎯 Objective

Create a new user alice with a custom welcome message and aliases using /etc/skel.

£à Step 1: Create Welcome Message

$ sudo nano /etc/skel/README.txt

📄 File Content:

Welcome to our server!

Some useful commands:
- To update the system: sudo apt update && sudo apt upgrade
- To check disk space: df -h

Please read the policy document at /etc/policy.txt
   

£à Step 2: Add Aliases to .bashrc

$ sudo nano /etc/skel/.bashrc

≡ƒæ¿ì≡ƒÆ╗ Add this at the end:

# Custom aliases for all new users
alias ll='ls -alF'
alias gs='git status'
   

£à Step 3: Create New User

$ sudo useradd -m -s /bin/bash alice

$ sudo passwd alice
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
   

£à Step 4: Verify User’s Home Directory

$ ls -a /home/alice

. .. .bash_logout .bashrc .profile README.txt
   

£à Step 5: Test the Environment

$ su - alice

$ cat README.txt
Welcome to our server!

Some useful commands:
- To update the system: sudo apt update && sudo apt upgrade
- To check disk space: df -h

Please read the policy document at /etc/policy.txt

$ ll    # Executes: ls -alF
$ gs    # Executes: git status (if inside a Git repository)
   

🏁 Final Result

  • User alice has a pre-configured welcome file and useful aliases.
  • All this setup came automatically from the /etc/skel directory.
  • Easy and consistent environment setup for new users!