Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Project 4-10 In this hands-on project, you view and set special permissions on f

ID: 3890006 • Letter: P

Question

Project 4-10
In this hands-on project, you view and set special permissions on files and directories as well
as modify the default ACL on a file.
1. Switch to a command-line terminal (tty3) by pressing Ctrl+Alt+F3 and log in to the terminal
using the user name of user1 and the password of LNXrocks!.
2. At the command prompt, type touch specialfile and press Enter. Next, type ls –l
at the command prompt and press Enter to verify that specialfile was created successfully.
Who is the owner and group owner of specialfile?
3. At the command prompt, type chmod 4777 specialfile and press Enter. Next, type
ls -l at the command prompt and press Enter. Which special permission is set on this
file? If this file were executed by another user, who would that user be during execution?
4. At the command prompt, type chmod 6777 specialfile and press Enter. Next, type
ls -l at the command prompt and press Enter. Which special permissions are set on
this file? If this file were executed by another user, who would that user be during execution,
and which group would that user be a member of?
5. At the command prompt, type chmod 6444 specialfile and press Enter. Next, type
ls -l at the command prompt and press Enter. Can you tell if execute is not given
underneath the special permission listings? Would the special permissions retain their
meaning in this case?
6. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal
using the user name of root and the password of LNXrocks!.
7. At the command prompt, type mkdir /public and press Enter. Next, type chmod
1777 /public at the command prompt and press Enter. Which special permission is
set on this directory? Who can add or remove files to and from this directory?
8. At the command prompt, type touch /public/rootfile and press Enter.
9. Type exit and press Enter to log out of your shell.
10. Switch back to your previous command-line terminal (tty3) by pressing Ctrl+Alt+F3.
Note that you are logged in as the user1 user on this terminal.
11. At the command prompt, type touch /public/user1file and press Enter. Next,
type ls -l /public at the command prompt and press Enter. What files exist in this
directory, and who are the owners?
12. At the command prompt, type rm /public/user1file and press Enter. Were you
prompted to confirm the deletion of the file?
13. At the command prompt, type rm /public/rootfile and press Enter. What message
did you receive? Why? Press y. Note the error message that you receive.
14. Type exit and press Enter to log out of your shell.
15. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal
using the user name of root and the password of LNXrocks!.
16. At the command prompt, type touch aclfile and press Enter. Next, type getfacl
aclfile at the command prompt and press Enter. Are there any additional entries
beyond user, group, and other?

Explanation / Answer

Notes:

The below bash commands are as notes in sh format and are not for combined execution. I couldn't get screenshots since you can't get gui apps working in ttys.

Code:

# change to tty3, cz I was on virtual box and alt + ctrl + f3 doesn't
# work (Virtual box shortcut issues). So you got another tip here on how
# to change environments.
sudo chvt 3
# change present user.
su - user1
# add a newfile incase it does not exist else changes the modified date of
# existing file to now.
touch specialfile
# list all files
ls -l
# onwer and group owner: user1

# I did chmod 4777
# permissions of the file are rws.
# I logged in as a different user and executed it, when we
# execute this file we run it as its owner ie., user 1

# doing chmod 6777 will actually set **s** flag on user group
# too so they can execute with their own uid's but other users
# cannot.

# chmod 6444
# execute is chopped off the permissions and hence we cannot
# execute this file, so the special **s** permission is
# useless, as s is for executing with owners uid, if you
# can't execute it, this special permission is useless.