Lab: Home Directories
Managing User Home Directories and Permissions
Scenario
You are a system administrator responsible for setting up user accounts on a Linux server. A new developer, Bob, has joined the team, and you need to create his user account, set up his home directory, and configure appropriate permissions.
Create Bob’s User Account
Use the adduser command to create Bob’s user account and set his password when prompted.
sudo adduser bobVerify Bob’s Home Directory
Confirm that Bob’s home directory has been created under /home.
ls /homeInspect Default Permissions
Use ls -l to view the permissions of Bob’s home directory and note the defaults.
ls -l /home/bobCustomize Bob’s .bashrc
First, switch to Bob’s account:
su - bobNext, add a custom alias for a deployment script to his .bashrc file.
echo "alias deploy='./deploy_script.sh'" >> ~/.bashrcSet Default Permissions for New Files
Check Bob’s current umask setting to see the default file permissions. You can modify this if needed to adjust defaults.
umaskTest the Customization
Log out of Bob’s account:
exitLog back in as Bob and test the newly created alias:
deployVerify Permissions
Check the permissions of the files and directories in Bob’s home directory again to ensure they reflect any customizations made.
ls -l /home/bobConclusion
In this exercise, you have successfully created a new user account for Bob, customized his .bashrc, and reviewed default permissions. This demonstrates how system administrators can tailor user environments to suit specific needs while maintaining security and privacy.
