0% found this document useful (0 votes)
202 views

Centennial College Information and Communication Engineering Technology Course: CNET 222 Lab 4: Managing Users and Groups in Ubuntu

This document provides instructions for managing users and groups in Ubuntu using both the command line interface and the graphical user manager tool. It describes how to: 1. View existing users and groups, add a new user named "elvis" and set their password, create a new group, add "elvis" to groups, and delete the group and user. 2. Install the graphical user manager tool gnome-system-tools, then use it to add a new user named "elvis" and set their password, similarly to the command line steps. 3. The document contains screenshots to capture the commands run and results, as well as questions about the purpose of certain commands and options used in managing users

Uploaded by

Patel Darshan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
202 views

Centennial College Information and Communication Engineering Technology Course: CNET 222 Lab 4: Managing Users and Groups in Ubuntu

This document provides instructions for managing users and groups in Ubuntu using both the command line interface and the graphical user manager tool. It describes how to: 1. View existing users and groups, add a new user named "elvis" and set their password, create a new group, add "elvis" to groups, and delete the group and user. 2. Install the graphical user manager tool gnome-system-tools, then use it to add a new user named "elvis" and set their password, similarly to the command line steps. 3. The document contains screenshots to capture the commands run and results, as well as questions about the purpose of certain commands and options used in managing users

Uploaded by

Patel Darshan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

CNET

222 Lab 4 Managing Ubuntu


Centennial College
Information and Communication Engineering Technology

Course: CNET 222

Lab 4:
Managing Users and Groups in Ubuntu

Instructions:

• Create a new Microsoft Word document


• Take screen shots where specified in the lab manual and paste
them into your Word document in the correct order.
• Make sure each image shows all the required information
including your virtual machine name as well as date and time of
the host computer.
• Total number of screen shots: 7 + 3
• Total number of questions: 8 + 1
• Answer all questions that appear in the lab instructions in your
Word document as well.

F. Shafique Page 1 of 11
CNET 222 Lab 4 Managing Ubuntu

Start the Ubuntu virtual machine.

There are two methods for managing users and groups:


a. Through the command line terminal (available on all Linux distributions)
b. Through the graphical user manager tool (requires additional packages on most
distributions)

Exercise 1. The Command Line Interface


In this exercise we will use the command line to explore some general commands related to
user management. Then we will add a new user, configure the password, create a new
group, manage group membership and finally delete the group and user. Remember that
only the root user can manage and add a new user to the system.
1. Open a Terminal window.
2. To view all the users on a system type: cat /etc/passwd
The result is the contents of a colon separated file (similar to a comma separated file
but using colons instead) in which each row contains seven columns (or fields). For
example, take the first row:

Column # Data Value root:x:0:0:root:/root:/bin/bash


1 root
2 x
3 0
4 0
5 root
6 /root
7 /bin/bash


Question 1: What do each of the seven fields represent? Hint: use the man pages by
typing the following command at the prompt: man 5 passwd.

F. Shafique Page 2 of 11
CNET 222 Lab 4 Managing Ubuntu

3. To view the numerical id the system relates with a particular user and their groups use
the id command followed by the username, for example, id root. Find the ids
associated with your user account (the one with your username).
Take screen shot # 1 showing the ids associated with your user.


4. The two commands to add a new user are useradd and adduser. You can use the
following commands to learn about them:
man useradd
man adduser
Take a look at the various options for these commands. Type q to exit from the manual
pages.
5. Now type the following command to create a new user:
sudo useradd –c “Elvis Presley” –m elvis
Enter your password when prompted.
Take screen shot # 2 showing the command ran without any error.
This will create a new user with username elvis and full name “Elvis Presley”.
Question 2: Has a home directory for user elvis been created? Hint: use the
command ls /home.
Question 3: What is the purpose of the –m option?
Note that since no password has been set for this user, you cannot login as elvis yet.
6. Set the password for user elvis with the following command:
sudo passwd elvis
When prompted, enter the password Pa$$w0rd. Confirm the password as required.
Take screen shot # 3 showing the command ran without error.
Question 4: Do you think you will be able to login as user elvis now?

F. Shafique Page 3 of 11
CNET 222 Lab 4 Managing Ubuntu


7. Note that the passwd command can be used to reset the password for any existing user
and to configure password properties such as password expiry. Set elvis’ password to
expire in 90 days with the following command:
sudo passwd -x 90 elvis


8. Let’s try another command to add a new user:
sudo adduser johnny
When prompted, enter the password Pa$$w0rd. When asked for the Full Name, give
Johnny Appleseed. Leave all other fields blank. Take screen shot # 4.
Question 5: Has a home directory for john been created?
Question 6: Do you think you can login as johnny?

F. Shafique Page 4 of 11
CNET 222 Lab 4 Managing Ubuntu

9. To create a new group use the groupadd command:
sudo groupadd students
10. We can use the id command and groups command to see what groups elvis is
currently a member of: id elvis; groups elvis
11. To add elvis to the students group, use the usermod command with –G option. Note
that the options are case sensitive and you must use a capital ‘G’. The lower case ‘g’
produces different results.
Question 7: Use the man pages to find the meaning of the –G and –g options, use the
command man usermod.
Now add elvis to the students group as follows:
sudo usermod –G students elvis
12. Use the id or groups command again to see what groups elvis is a member of. Take
screen shot # 5.


13. Now let’s add another group named celebrities using a different command and
add elvis to it:
sudo addgroup celebrities
sudo usermod –G celebrities elvis
groups elvis

F. Shafique Page 5 of 11
CNET 222 Lab 4 Managing Ubuntu

Note that elvis is now a member of the celebrities group but has been removed from
the students group. Find the appropriate option(s) of the usermod command so that
elvis is a member of both groups. Try out the command, check the result with the
groups command and take screen shot # 6 showing both the command you used and
the expected result shown below. Make sure the image shows the command you used.


14. Delete the group celebrities using the groupdel command:
sudo groupdel celebrities
15. Delete the user elvis with the userdel command:
sudo userdel elvis


16. Delete the user johnny: sudo userdel –r johnny
Take screen shot #7 showing all three deletions (celebrities, elvis and johnny).
Question 8: What is the purpose of the –r option in the userdel command?


Further Research:
- Look at the manual pages for the commands used in this lab:
• useradd
• usermod
• userdel
• groupadd
• groupdel
• passwd

F. Shafique Page 6 of 11
CNET 222 Lab 4 Managing Ubuntu

Lab Challenge. The Graphical User Manager Tool


We must install the graphical tool in Ubuntu before we can use it. The package to install is
called gnome-system-tools, we will use apt for the installation. Once installed, we will
use the graphical tool to perform the same actions we did in exercise 1 on the command
line.
1. Install the required package with the following command:
sudo apt install -y gnome-system-tools
Reminder: Apt determines dependencies and installs all required packages. This means
that it determines what other packages must be installed to allow the requested
package to work correctly. You will need a working Internet connection for this to
work.
2. Run the graphical user settings tool by typing the following: users-admin &
Question 9: What is the purpose of the ‘&’?
The User Settings window should launch.

F. Shafique Page 7 of 11
CNET 222 Lab 4 Managing Ubuntu

3. To add a new user, click on the Add button. Enter your password when prompted. The
‘Create a new user’ dialog will appear. Fill out the required data for the new user,
including the full name and username.
Name: Elvis Presley
Username: elvis


4. Click on the OK button to add the new user. The ‘Change User Password’ dialog box
appears. Enter the password Pa$$w0rd twice and click OK.


Once added, the new user should appear in the list of users in the settings dialog and it
should be possible to login in using the new username and specified password.
Take screen shot # 8 showing user Elvis Presley in the list of users.

F. Shafique Page 8 of 11
CNET 222 Lab 4 Managing Ubuntu

5. Group membership can be managed from the User Settings too. Click on the Manage
Groups button on the middle left. Scroll down and select students, click Properties. In
the Group Member section, check ‘Elvis Presley’ to add elvis to the students
groups. Click OK. Enter your password if prompted and click OK.


6. On the ‘Group settings’ dialog box, click Add. The ‘New group’ dialog box opens.
7. Enter celebrities in the Group name text box, from the Group Member section select
‘Elvis Presley’ again and click OK. Scroll the list of groups to find the celebrities group
and click on Properties. Take screen shot # 9 showing the group members of the
celebrities group.
Click OK.

F. Shafique Page 9 of 11
CNET 222 Lab 4 Managing Ubuntu

8. To remove the celebrities group, select the group from the list and click Delete.
Confirm the deletion by clicking Delete. Then close the Group settings by clicking Close.


9. To remove the user, select Elvis Presley and click Delete. Click Delete Files.
Take screen shot # 10 showing the user is deleted.
10. Click Close to close the ‘User Settings’ window.
11. Remove the graphical user management tool with the following commands:
sudo apt remove -y gnome-system-tools
sudo apt autoremove

F. Shafique Page 10 of 11
CNET 222 Lab 4 Managing Ubuntu

Submit your Word Document to the correct Assignment Folder.

Shut down you Virtual Machine

Make sure you have all your work on your external USB hard disk.

You are done!

F. Shafique Page 11 of 11

You might also like