๐งช Linux Lab: /etc/skel Directory
Creating a Default Environment for New Users
๐ฏ Objective
To configure default user environments using the /etc/skel directory in Linux.
๐งฐ Prerequisites
- Basic Linux command-line knowledge
sudoprivileges- Access to a text editor like
nanoorvim
๐ Lab Tasks
๐น Task 1: View Existing /etc/skel Content
$ ls -a /etc/skel
๐น Task 2: Create a Custom Welcome File
$ 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
๐น Task 3: Add Aliases to .bashrc
$ sudo nano /etc/skel/.bashrc
๐ Add at the end:
# Custom aliases for all new users
alias ll='ls -alF'
alias gs='git status'
๐น Task 4: Create a New User
$ sudo useradd -m -s /bin/bash alice
$ sudo passwd alice
๐น Task 5: Verify User Home Directory
$ ls -a /home/alice
. .. .bash_logout .bashrc .profile README.txt
๐น Task 6: Switch to New User and Test
$ su - alice
$ cat README.txt
$ ll
$ gs
๐ Expected Outcome
- New user gets a welcome file:
README.txt - Aliases
llandgswork as expected - No need for manual configuration per user
๐ง Lab Questions
- What is the role of the
/etc/skeldirectory? - How does the system copy these files to a new user?
- Will changes in
/etc/skelaffect existing users? - How can you set environment variables for all new users?
โ Conclusion
This lab shows how /etc/skel helps automate user environment setup, improving consistency and reducing setup time for administrators.
