BCE-C712 Linux System Administration

0 of 74 lessons complete (0%)

Managing User Accounts

LAB

You don’t have access to this lesson

Please register or sign in to access the course content.

Practical Exercise: 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.

Steps:

  1. Create Bob’s User Account:
    • Use the adduser command to create Bob’s user account.
    sudo adduser bob
    • Set a password for Bob when prompted.
  2. Verify Bob’s Home Directory:
    • Confirm that Bob’s home directory has been created under /home or the designated home directory location on your system.
    ls /home
  3. Inspect Default Permissions:
    • Use the ls -l command to view the permissions of Bob’s home directory and its contents.
    ls -l /home/bob
    • Note the default permissions set by the system.
  4. Customize Bob’s .bashrc:
    • Switch to Bob’s account.
    su - bob
    • Edit Bob’s .bashrc file to add a custom alias. For example, create an alias for a development command:
    echo "alias deploy='./deploy_script.sh'" >> ~/.bashrc
    • Save and exit the text editor.
  5. Set Default Permissions for New Files:
    • Check Bob’s current umask setting to see the default file permissions.
    umask
    • If needed, modify Bob’s umask to adjust default permissions.
  6. Test the Customization:
    • Log out of Bob’s account:
    exit
    • Log back in as Bob and test the newly created alias:
    deploy
    • This command should execute the deployment script.
  7. Verify Permissions:
    • Check the permissions of the files and directories in Bob’s home directory to ensure they reflect the customizations made.
    ls -l /home/bob
  8. Bonus: Implement ACLs (Optional)
    • If your system supports Access Control Lists (ACLs), you can explore setting specific permissions for Bob’s files or directories.

Conclusion:

In this exercise, you have successfully created a new user account for Bob, customized his .bashrc to include a custom alias, and set default permissions. This exercise demonstrates how system administrators can tailor user environments to suit specific needs while maintaining security and privacy.