Creating, renaming, removing, opening, reading from, writing to, and executing files can only be done the operating system. As such, the OS gets to decide when to approve a request to do one of these things and when to reject it. Although not all OSs use the same system, the POSIX standard defines a set of file permissions that are commonly used.
Work, ideally with a partner1, to achieve the following:
Answer the first question about converting from a letter permission to numeric permission or vice-versa on the answer sheet.
Create a directory either:
- in your home directory, or
- in
/localtmpon the portal machines. (/bigtempwill not work, it does not support ACLs.) Do each of the following steps in that directory.
Make sure the directory is accessible to your partner. Use
chmodorsetfaclto set permissions on the directory.If it is in your home directory, then by default the permissions on your home directory disallow access to anything inside it, even if those files or directories are themselves set to allow access. You can change this with something like
chmod og+x /u/COMPUTING-ID(On directories,xissearch
permission; which allows accessing files within the direcgtory if you know their names).If it is in
/localtmp, make sure you are on the same portal backend machine, like you did for the signals lab.
Create a directory
dirwith a filefooand a filebazwhere you canlsandcatfreely, but your partner finds thatls dirrefuses to runcat dir/fooworkscat dir/bazrefuses to run
Create a file
shared.txt
and set its access control list so that- you can read and write it
- your partner can read it
- other users (including TAs) cannot do either one
Make a file
simple.shwhich can be run both bybash simple.shand./simple.shcontaining bash commands that- appends a line containing the current day and time to file
simple_runs - reports how many lines
simple_runscontains (See the section of the reading on executable text files.)
- appends a line containing the current day and time to file
Determine which of the following are possible to achieve and write your answers (with a brief explanation) on the answer sheet:.
cat xyxxyworks butecho 'hi' >> xyxxydoes notecho hi >> xyxxyworks butcat xyxxydoes not./xyxxyworks butcat xyxxydoes not./xyxxyworks butecho hi >> xyxxydoes not
Either:
- check off your lab completion with a TA, or
- from your home directory, run
tar --acls -cvf permissions-lab.tar BASE-DIRECTORYwhereBASE-DIRECTORYis the directory you created for everything in the lab. Then uploadpermissions-lab.tarto the submission site.
The information needed to achieve these goals is explained in the reading on permissions. We recommend you read it in full, discussing it with a partner and asking clarifying questions of TAs as you go, then return to the tasks above.
If you don’t work with a partner, you may use the username
nobody
in place of what would be your partner’s username. But you won’t be able to verify that some of your permissions settings work, which is why I would very strongly recommend having a partner.↩︎