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.
