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 bob
Verify Bob’s Home Directory
Confirm that Bob’s home directory has been created under /home
.
ls /home
Inspect Default Permissions
Use ls -l
to view the permissions of Bob’s home directory and note the defaults.
ls -l /home/bob
Customize Bob’s .bashrc
First, switch to Bob’s account:
su - bob
Next, add a custom alias for a deployment script to his .bashrc
file.
echo "alias deploy='./deploy_script.sh'" >> ~/.bashrc
Set 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.
umask
Test the Customization
Log out of Bob’s account:
exit
Log back in as Bob and test the newly created alias:
deploy
Verify 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/bob
Conclusion
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.