(100 points) This problem asks you to explore file permissions and
types in the UNIX operating system. You are to write a command called
access that takes as arguments a user ID and a path name. It determines
how the named user can access the object with the given path name. For
example,
access bishop /home/bishop/xyz
prints
bishop can read, write /home/bishop/xyz
but
access bishop /home/cs153r/handin/hw1/knowles
prints
bishop cannot access /home/cs153r/handin/hw1/knowles
If the option -l is given, the same information is to be printed for each
element of the path:
access -l bishop /home/cs153/public_html/homepage.html
prints
bishop can list, search /
bishop can list, search /home
bishop can search /home/cs153
bishop can list, search /home/cs153/public_html
bishop can read /home/cs153/public_html/homepage.html
What follows are some suggestions that may help you.
- Read, write, and execute permission on directories are really list,
create/delete file, and search permission. Without search permission, a process
cannot access any files in the directory (even if read and create/delete files
permissions are given).
- For symbolic links, list the permissions on the symbolic link, and on the
next line the permissions of the referent. Use lstat(2) and
stat(2) to go this.
- If the named user cannot access a component of a path, it cannot
access any of the following components.
You can also see this document
in its native format,
in Postscript,
in PDF,
or
in ASCII text.
Send email to
cs153@csif.cs.ucdavis.edu.
Department of Computer Science
University of California at Davis
Davis, CA 95616-8562
Page last modified on 1/28/98