is the structure of root’s home directory. All files belong to root. Can you per
ID: 3752463 • Letter: I
Question
is the structure of root’s home directory. All files belong to root. Can you perform the following commands, if you are logged in as Alex and is currently in Alex’s home directory (/home/alex)? If not, explain why. Alex is in a different group than root.
a) cat /root/sw3333/grades
b) rm –R /root/csci4634/assignments
c) touch /root/myfile
d) /root/csci4634/notes/exam1
e) mkdir /root/csci4634/mydir
f) cp f1 /root/test
Thanks!!
oot drwx--x--x admin -rwx csci4634 drwxwx sw3333 drwx--r- grades wx notes drwx-r exam1 assignments drwx--r- assignl rw-rr progl -rwxr-xr-x -Explanation / Answer
This question can be easily answered if we understand the basic idea of unix file permission flags.
Every file/Directory is associated with 10 flags,
The first flag is used to identify directories, so it will be 'd' if the current object is a directory.
the next 9 flags can be thought of groups of three flag
'r' = which means if read permission is present or not
'w' = which means if write permission is present or not
'x' = which means if executable permission present or not/ for directories if listing files is permitted or not
So there are three such groups, the first group gives us the permission of the owner of the file,
the secod group tells us the permissions of the group of the owner, and the last one tells us the permissions of public.
Now lets analyze the questions and its answers,
a) cat /root/sw3333/grades
If we look at the permission of the file grades then it is something like this,
-rwx------ Which means it is a file, and the owner have all the permission to read, write and execute this file, but no one else can read execute or modify the file, hence the command can not execute as Alex is not root. and he is trying to read this file by using the command.
b) rm –R /root/csci4634/assignments
If we see the flags of Assignments, it is some thing like,
drwx---r-x which means the root can read, write and execute but the public can only read and execute the files in this directory. So the command will not be executed as it tries to modify(Delete!) the directory along with all its subdirectories.
c) touch /root/myfile
the root directory can be only modified by the admin/root hence Alex cant create a new file in /root
d) /root/csci4634/notes/exam1
this command tries to execute the file exam1. As seen in the flags no permission is given to this file so this command will not be executed
e) mkdir /root/csci4634/mydir
Similar as above Alex can modify files inside this directory. So he can execute this command
f)cp f1 /root/test
this command copies the content of file f1 inside the file /root/test but Alex does not have the permission to write inside this root directory, so he will not be able to execute it.
Happy Chegging!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.