13.1.17 Lab - Configure Authentication and Authorization in Linux
13.1.17 Lab - Configure Authentication and Authorization in Linux
Objectives
Part 1: Add a New Group for Users
Part 2: Add Users to the New Group
Part 3: Switch Users and Modify Permissions
Part 4: Modify Permissions in Absolute Mode
Background / Scenario
In this lab, you will use the Linux command line to create a group for new users and add users to the group.
Each user will be assigned a password for authenticating at login. Then you will modify permissions to
authorize read, write, and execute privileges for both users and groups.
Required Resources
PC with the CSE-LABVM installed in VirtualBox
Instructions
2017 - 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 1 of 9
Lab - Configure Authentication and Authorization in Linux
<output omitted>
Alice:x:1000:
Bob:x:1001:
Eve:x:1002:
Eric:x:1003:
Xnobody:x:1004:
HR:x:1005:
The new group HR is shown at the bottom of the /etc/group file with a group ID of 1005.
Step 1: Add Jenny as a new user and move her to the HR group.
a. Complete the following to add Jenny as a user:
1) Enter the adduser jenny command and press Enter.
2) Enter jenPass as the password, and then press Enter.
3) Re-type the new password, and then press Enter.
4) Enter Jenny for Full Name, and then press Enter.
5) For the rest of the configuration, press Enter.
6) Enter Y to verify the information is correct, and then press Enter.
root@labvm:/home/cisco# adduser jenny
Adding user `jenny' ...
Adding new group `jenny' (1006) ...
Adding new user `jenny' (1005) with group `jenny' ...
Creating home directory `/home/jenny' ...
Copying files from `/etc/skel' ...
New password: jenPass
Retype new password: jenPass
passwd: password updated successfully
Changing the user information for jenny
Enter the new value, or press ENTER for the default
Full Name []: Jenny
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y
root@labvm:/home/cisco#
b. Move jenny to the HR group. Enter the usermod -G HR jenny command to move jenny to the HR group.
root@ubuntu:/home/cisco# usermod –G HR jenny
Step 2: Add Joe as a new user and move him to the HR group.
a. Enter the adduser joe command and then complete the steps to assign joe the password joePass and
full name Joe.
2017 - 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 2 of 9
Lab - Configure Authentication and Authorization in Linux
2017 - 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 3 of 9
Lab - Configure Authentication and Authorization in Linux
The Linux operating system has a total of 10 letters or dashes in the permissions fields. For example,
these home directories have the following permissions: drwxr-xr-x.
o A d in the first field indicates that this is a directory. A dash (-) would mean that it is a file.
o The next set of three characters is for user permission (rwx). For example, the user, jenny, owns the
directory and can read, write, and execute the file.
o The second set of three characters is for group permissions (r-x). The group is jenny, meaning that no
group, other than jenny, can write to this directory.
o The third set of three characters is for any other user or group permissions (r-x). Any other user or
group on the computer can read or execute, but not write to the directory.
c. As Jenny, enter command cd joe to enter Joe's directory. Notice that we are able to navigate to Joe’s
directory because the permission for others is r-x. The x allows anyone to enter the directory.
jenny@labvm:/home$ cd joe
jenny@labvm:/home/joe$
d. While in Joe's directory, enter the touch new.txt command to create a file. You are denied because user
jenny does not have permission to write to Joe's directory.
jenny@labvm:/home/joe$ touch new.txt
2017 - 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 4 of 9
Lab - Configure Authentication and Authorization in Linux
2017 - 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 5 of 9
Lab - Configure Authentication and Authorization in Linux
chmod u+rwx Adds read, write, and execute permissions for the user
chmod u+rw Adds read and write permission for the user
chmod o+r Adds read permission for others
chmod g-rwx Removes read, write, and execute permissions for the group
Blank Line, No additional information
Step 3: Use absolute mode to modify, and then verify the permissions for Joe's directory.
The other way of assigning permissions besides using symbolic permissions is the use of absolute
permissions. Absolute permissions use a three-digit octal number to represent the permissions for owner,
group and other.
2017 - 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 6 of 9
Lab - Configure Authentication and Authorization in Linux
The table below outlines each absolute value and its corresponding permissions:
Number Permissions
1 Execute
0 None
Blank Line, No additional information
By typing the chmod 764 examplefile command, the "examplefile" will be assigned the follow permissions:
1-Read
1-Write
7 (user) 111 1-Execute
1-Read
1-Write
6 (group) 110 0-No Execute
1-Read
0-No Write
4 (others) 100 0-No Execute
Blank Line, No additional information
a. Modify the “others” field for Joe’s folder so that others will be able read and execute but not write while still
maintaining the “user” field to read, write, and execute.
joe@labvm:/home$ chmod 705 joe
b. List the file permissions of the current directory to see that the absolute changes were made.
joe@labvm:/home$ ls -l
total 28
drwxr-xr-x 2 Alice Alice 4096 Mar 18 21:58 Alice
drwxr-xr-x 2 Bob Bob 4096 Mar 18 21:58 Bob
drwxr-xr-x 12 cisco cisco 4096 Mar 19 20:02 cisco
drwxr-xr-x 2 Eric Eric 4096 Mar 18 21:58 Eric
drwxr-xr-x 2 Eve Eve 4096 Mar 18 21:58 Eve
drwxr-xr-x 9 jenny jenny 4096 Mar 20 14:02 jenny
drwx---r-x 9 joe joe 4096 Mar 20 15:01 joe
joe@labvm:/home$
2017 - 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 7 of 9
Lab - Configure Authentication and Authorization in Linux
Step 7: Change to the joe directory and list the contents of the directory.
Notice that user jenny, as a member of "others", has read access to the joe directory and also has read
access for the "test.txt" file.
jenny@labvm:/home$ cd joe
jenny@labvm:/home/joe$ ls -l
total 12
drwxr-xr-x 2 joe joe 4096 Mar 20 15:00 Desktop
drwxr-xr-x 2 joe joe 4096 Mar 20 15:00 Documents
drwxr-xr-x 2 joe joe 4096 Mar 20 15:00 Downloads
-rw-rw-r-- 1 joe joe 0 Mar 22 14:33 test.txt
jenny@labvm:/home/joe$
2017 - 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 8 of 9
Lab - Configure Authentication and Authorization in Linux
Step 9: Switch user from jenny to cisco and close the VM.
a. Click Menu at the top left of the desktop. At the bottom of the dropdown menu, click the button with the
tool tip End the current session.
b. Click Switch User from the dialog box.
c. Click Cybersecurity Analyst from the list of available users and enter password as the password.
d. Click File > Close, choose Save the machine state, and then click OK.
End of document
2017 - 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 9 of 9