Linux System Administration

0 of 77 lessons complete (0%)

Managing User Accounts

LAB: /etc/skel

You don’t have access to this lesson

Please register or sign in to access the course content.

Linux Lab: /etc/skel Directory

๐Ÿงช 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
  • sudo privileges
  • Access to a text editor like nano or vim

๐Ÿ“ 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 ll and gs work as expected
  • No need for manual configuration per user

๐Ÿง  Lab Questions

  • What is the role of the /etc/skel directory?
  • How does the system copy these files to a new user?
  • Will changes in /etc/skel affect 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.