Linux System Administration

0 of 85 lessons complete (0%)

Managing User Accounts

LAB: User Accounts

You don’t have access to this lesson

Please register or sign in to access the course content.

Customizing User Profiles for a Developer

In this lab scenario, you will assume the role of a system administrator responsible for setting up a user account for a developer named Alice. Alice requires a customized environment with specific aliases and environment variables to streamline her development tasks.

Step 1: Creating a New User Account for Alice

  1. Open a terminal and log in as the system administrator.
  2. Create a new user account for Alice: sudo adduser alice Follow the prompts to set a password and provide additional user information.

Step 2: Customizing .bashrc for Alice

  1. Switch to Alice’s account: su - alice
  2. Edit Alice’s .bashrc file to add custom aliases and environment variables. For example, let’s add an alias for a frequently used development command: echo "alias build='make -j4'" >> ~/.bashrc This alias will allow Alice to run a parallel build with four jobs using the build command.
  3. Save and exit the text editor.

Step 3: Customizing .bash_profile for Alice

  1. If .bash_profile doesn’t exist, create it: touch ~/.bash_profile
  2. Edit Alice’s .bash_profile to source the .bashrc file: echo "source ~/.bashrc" >> ~/.bash_profile This ensures that the customizations in .bashrc are applied when Alice logs in.
  3. Save and exit the text editor.

Step 4: Customizing .profile for Alice

  1. If .profile doesn’t exist, create it:bashCopy codetouch ~/.profile
  2. Edit Alice’s .profile to source the .bashrc file: echo "source ~/.bashrc" >> ~/.profile This ensures that the customizations in .bashrc are applied when using non-interactive login shells.
  3. Save and exit the text editor.

Step 5: Testing the Customizations

  1. Log out of Alice’s account:bashCopy codeexit
  2. Log back in as Alice. You should see the custom alias in action:bashCopy codebuild This command should initiate a parallel build with four jobs.

Conclusion:

You have successfully customized the user profiles for Alice, providing her with a tailored environment for her development tasks. This lab demonstrates the importance of user profiles in creating a personalized and efficient working environment for users with specific needs.