Open main menu

CDOT Wiki β

OPS235 Lab 4 Braille

Stop (medium size).png
Braille Only
If you are not using a braille reader, please use OPS235 Lab 4 instead of this lab.

User & Group Management

Introduction

  • In this lab, you will learn how to manage (add, delete, modify) user accounts on your Fedora systems. You will also learn how to create and maintain groups to allow users to share and protect data.

Objectives

  1. Learn how to add and remove and modify user accounts.
  2. Learn how to create and manage groups.

Linux Command Online Reference

Each Link below displays online manpages for each command (via http://linuxmanpages.com):

Resources on the web

Additional links to tutorials and HOWTOs:

Investigations: User/Group Management

Investigation 1: The /etc/passwd file

Perform this investigation on the VM named fedora1.

  1. Read about the file: http://linux.die.net/man/5/passwd
  2. Now look at the contents of the /etc/passwd file.
  3. Make note of the contents of that file, and make certain and record in your lab log-book the information that each field contains.
  4. Why do you think there are so many users?
  5. Look at the names of the users. What do you think these user names represent? Are they people?
  6. What is the numeric user ID (UID) of the root user?
  7. The user IDs of real users (people) are different from the user IDs of system accounts. What is the pattern?

Answer the Investigation 1 observations / questions in your lab log book.

Investigation 2: Adding users

Perform this investigation on the VM named fedora1.

  1. Read the man page for the useradd command.
  2. Create a new user account for each of your pod-mates, using their learn account name as a user name. Give each user a password. If you don't have any pod-mates at the time you do this lab, create dummy users, and test access from another computer.
  3. Use the grep command to obtain information for each of the newly created users within the /etc/passwd file.
    • What is the home directory of each user?
    • What group is each user in?
    • What else do you know about each user?
    • Where are the passwords stored?
  4. Look at the man page for /etc/shadow using the command man 5 shadow
    • Grep the /etc/shadow file for each of the new users.
    • Make note of this information.
    • What is the purpose of the /etc/shadow file?
  5. Create two new dummy users, ops235_1 and ops235_2.
  6. Investigate the home directory of one of your new users.
    • What files are there? Be sure to include hidden files.
    • What do you think these files are used for ?
    • How does the operating system determine which files are created in a new home account?
      The answer can be found here: http://www.linuxhowtos.org/Tips%20and%20Tricks/using_skel.htm
    • Look at the files (including hidden files) in the template directory referred to in the article. Compare them to what is in a home directory for a new user. What do you notice?
    • Create a new file in this directory with the following command: touch foo
    • Create a new user named foobar, with the option to automatically create a home directory.
    • Look at the contents of foobar's home directory. What do you notice?
  1. Boot-up your fedora3 VM.
  2. Create a new user using your Matrix account user-name.
  3. Issue a command to verify that you have created this user account.

Answer the Investigation 2 observations / questions in your lab log book.

Investigation 3: Managing Groups

Use fedora1
Perform these steps in the fedora1 virtual machine.
  1. Read the man page for the groupadd and groupdel commands.
  2. Note which option allows you to set the Group ID number (GID) when you create a new group.
  3. Examine the file /etc/group
    1. Which values of GID are reserved for system accounts?
    2. Which values of GID are reserved for non-system user accounts?
    3. What is the lowest available GID number for non-system users?
    4. What is the default group name of a new user?
    5. Add a new group named ops235 with a GID of 600.
    6. You are angry at some irresponsible users on your system.
      • Add a new group named idiots.
      • Look at /etc/group and note the GID of idiots.
      • What GID is given to a new group if you do not specify it?
      • Your anger has subsided. Delete the idiots group.
      • Look at /etc/group again and note the change.

Be sure to record your observations in your lab notes.

Answer the Investigation 3 observations / questions in your lab log book.

Investigation 4: Deleting users

Use fedora1
Perform these steps in the fedora1 virtual machine.
  1. Read the man page for the userdel command. Note which option automatically removes the users home directory when that user is deleted.
  1. Delete the user ops235_1 using the command userdel ops235_1
  2. Delete the user ops235_2 using the same command with the option which removes the home directory of the user.
  3. Check the contents of the /home directory. What do you notice?
  4. Check the contents of the /etc/group directory. What do you notice?

Answer the Investigation 4 observations / questions in your lab log book.

Investigation 5: Modifying users

Perform this investigation on the VM named fedora1.

  1. Read the man page for the usermod command. Note which options change the user's full name, primary group, supplementary groups, and shell.
  2. Add each of your new pod mate accounts to the group ops235 (in other words, add ops235 to each user as a supplementary group).
  3. Examine /etc/group. What has changed?
  4. Experiment with your pod-mate accounts to share and deny access to same group members by creating directories and files, and use the chmod command. How is the /etc/group related to file sharing permissions?
  5. Use the usermod command to associate each of your pod mates' full name to their user name, as shown in your text. With each change, examine their entries in the /etc/passwd file. What has changed?
  6. Just for interest, how would you use a graphical utility to modify user account information?
  7. Be sure to record your observations in your lab notes.
Shutdown VMs
It is time to safely shut-down all of your Virtual Machines. Please proceed to Completing the Lab

Answer the Investigation 5 observations / questions in your lab log book.

Completing the lab

Time for a new backup!
If you have successfully completed this lab, make a new backup of your virtual machines. Remember to also make a backup of the new second virtual disk drive on fedora1 -- you now have two virtual disks on fedora1, and therefore two image files, and therefore will need two backup files.

Arrange proof of the following on the screen:

  1. Proof of ops235 group entry in /etc/group in fedora1 VM
  2. Proof of pod-mate user account information in /etc/passwd in fedora1 VM.
  3. Proof of VM backups.

Preparing for Quizzes

  1. What are the purposes of the following files: /etc/passwd, /etc/shadow, /etc/group?
  2. Explain the purpose of the /etc/skel directory.
  3. What do the terms UID and GID represent. What is their purpose?
  4. List the steps to create a user account on a system.
  5. List the steps to change user account information on a system.
  6. List the steps in order for users to share file and directory accounts as "same group members".
  7. List the steps to remove a user account. What is required to remove a user account's home directory as well?