Section 10 Lab
LPIC-1, Exam 1 (101-500)
By Christine Bresnahan
Recommended Linux Distributions for this exercise:
• CentOS version 7
• Ubuntu Desktop 18.04LTS
Note: For a successful lab session, it is assumed you are using the recommended Linux distribution(s) and
the recommended version, and that your Linux systems are booted. In addition, it is assumed that you can log
into the system as a standard user as well as either the root account or a user with super user privileges. Also,
you should have successfully completed the prior sections’ labs and sessions & viewed this section's videos.
Follow these actions to explore concepts and commands covered in this section (but please feel free to
explore as much as you want. And don’t forget that you can get help on the usage of these commands
through the man pages. Type in man and follow it with the utility name, then press Enter to view
information on the utility):
1. Log into either your Ubuntu or CentOS distro tty2 terminal, using the username and password you
created when you installed the system.
2. If you are logged into the CentOS distro, and do not have access to use the sudo command for super
user privileges, log into the root account, by typing su - and pressing Enter, then enter the root account's
password, you created when you installed the system. You will need to NOT enter sudo whenever it is
listed for a step. WARNING: Be careful in the root account!
3. Create a file by typing touch [Link] and pressing enter.
4. View the long listing for the file by typing ls -l [Link] and pressing enter. Record the file's owner and
group members.
5. Find a group on the system that is different than the [Link] file's group, by typing less /etc/group
and pressing Enter. When you find a group, press q to quit the less pager. (Hint: A typical group on
most distributions is: mail).
6. Modify the file's group membership by typing sudo chgrp new-group-name [Link] and pressing
Enter. (Don't actually type new-group-name, but instead substitute the group name you selected from
the previous step.)
7. See if the group membership of the file changed by typing ls -l [Link] and pressing Enter. If it did not,
go back to the previous step and fix any mistakes you may have made.
8. Find a username on the system that is different than the [Link] file's owner (username), by typing
less /etc/passwd and pressing Enter. When you find new owner (username), press q to quit the less
pager. (Hint: A typical group on most distributions is: games).
9. Modify the file's group membership by typing sudo chown new-owner-name [Link] and pressing
Enter. (Don't actually type new-owner-name, but instead substitute the username you selected from the
previous step.)
10. See if the owner of the file changed by typing ls -l [Link] and pressing Enter. If it did not, go back to
the previous step and fix any mistakes you may have made.
11. Change back the owner and the group membership of the [Link] to its original owner and group
membership, by typing sudo chown old-owner-name:old-group-name [Link] and pressing Enter.
(Don't actually type old-owner-name:old-group-name, but instead substitute the username and the
group name you recorded in step #4, and separate them with a colon(:).)
12. See if the owner and group membership of the file changed by typing ls -l [Link] and pressing Enter.
If it did not, go back to the previous step and fix any mistakes you may have made.
13. Change the file's World permissions using symbolic mode by typing chmod o+rwx [Link] and
pressing Enter.
14. See if the file's World permission are set to rwx, by typing ls -l [Link] and pressing Enter.
15. Change all the file's permissions using octal mode, by typing chmod 777 [Link] and pressing Enter
(Note: This won't change the World permissions which are already set to 7 in step #13.)
16. See if the file's permissions are set to rwxrwxrwx, by typing ls -l [Link] and pressing Enter.
17. Modify the file's permissions again, by typing chmod 664 [Link] and pressing Enter.
18. See if the file's permissions are now set to rw-rw-r--, by typing ls -l [Link] and pressing Enter.
19. Typically there is a special permission set on the /tmp directory. View it by typing ls -ld /tmp and
pressing Enter. Which special permission is it (SUID, SGID, or stick bit)?
20. Typically there is a special permission set on the passwd command. First find the absolute directory
reference of the passwd command, by typing which passwd and record the resulting absolute directory
reference to the passwd command's program.
21. Using the absolute directory reference you recorded in the previous step, view the special permission set
on the passwd command's program file, by typing ls -l absolute-directory-reference/passwd and
pressing Enter. (Don't actually type absolute-directory-reference, but instead use the absolute directory
reference for the passwd command you recorded in the previous step.) Which special permission is set
on this file (SUID, SGID, or stick bit)?
22. View the current umask setting you are using, by typing umask and pressing Enter. Record the resulting
number.
23. Create a new file by typing touch [Link] and pressing Enter.
24. View the permissions set on the [Link] by typing ls -l [Link] and pressing Enter. Since
files are created with the default permissions of 0666, did the umask setting properly remove the
permissions for the newly created file? (Example: If your umask is set to 0002, then creating a file should
result in a created file with 0664 octal code permissions, which are rw-rw-r--).
25. Create a soft link to your newly created file, by typing ln -s [Link] lab10Soft and pressing Enter.
26. View the long listings for both these files by typing ls -l [Link] lab10Soft and pressing Enter.
You should see some differences in the long listing for the lab10Soft file.
27. View the long listing for your original file for this lab by typing ls -l [Link] and pressing Enter.
28. Create a hard link to your original file for this lab by typing ln [Link] lab10Hard and pressing Enter.
29. View the long listings for both these files by typing ls -l [Link] lab10Hard and pressing Enter. You
should notice for both files an increased link count.
30. View the inode numbers for these files by typing ls -i [Link] lab10Hard and pressing Enter. Notice
that the numbers match (because they share an inode number).
31. Delete any files you created for this lab using the appropriate command(s).