Computer Science 432/563
Operating Systems
Spring 2016, The College of Saint Rose
In this lab, you will learn about some details of file systems beyond what we have covered in class.
You may work alone or with a partner on this lab.
Create a file in your directory for this lab in which you will answer the questions scattered throughout the lab.
Standard Unix File Protection
Unix is a multi-user operating system, and you must authenticate to indicate "who you are" to a Unix system. A major reason for this is to facilitate file protection. File protection allows the creator of a file to decide who should be able to view a file, modify a file, or execute a file.
We will first consider the "standard" Unix file permission scheme, then look at the more flexible permissions provided with the AFS file system, such as that used by our SoS home directories.
Unix UIDs and GIDs
The files that a user is permitted to access are determined by the user's processes' user id (UID) and group id (GID). Each user on a Unix system is assigned a unique UID, which is a number associated with the login name, and can be part of one or more groups.
You can find out which UID is associated with your shell using the id command.
User/Group/Other permissions
All files in a standard Unix filesystem have an owner, which should correspond to the UID of a valid user on the system, and a group. Each file or directory has a set of permissions that specify what kinds of operations on that file or directory are permitted for the owner, i.e., a process with the same UID as the file, for the group, i.e., a process whose GID is the same as the file, and for all other processes on the system.
To see a file's permissions, we use ls -l to obtain a long-format directory listing. Here are the first few lines printed when I do this on the /home/cs432/examples directory on ascg.strose.edu:
-> ls -l total 144 drwxr-xr-x 2 terescoj wheel 512 Feb 3 13:04 addingone -rw-r--r-- 1 terescoj wheel 547 Feb 3 13:04 addingone.tar.gz drwxr-xr-x 2 terescoj wheel 512 Mar 1 15:24 everyother -rw-r--r-- 1 terescoj wheel 941 Mar 1 15:24 everyother.tar.gz drwxr-xr-x 2 terescoj wheel 512 Mar 1 15:25 exec -rw-r--r-- 1 terescoj wheel 1776 Mar 1 15:25 exec.tar.gz
Let's dissect this output. The total line indicates how many kilobytes of disk the files use. Each subsequent line provides information about a file. The first chunk of text specifies file permissions (more on this below). Next is the number of hard links to the file, which we discussed previously. Next are is the UID and GID of the file's owner. The rest is the size of the file in bytes, the date and time that the file was last modified, and the name of the file.
The file permission string starts with a single character indicating a file type, followed by three triples. The first triple specifies permissions for the owner, the next the permissions for the members of the group, and the last the permissions for all other users.
Each triple indicates whether a category of processes can do each of three operations:
The file type character is - for normal files, and d for directories.
Each of the three successive triples specifies the read, write, and execute permissions. The letter is present if the permission is granted, and will be a - if not:
The meaning of protection is interpreted a bit differently for directories:
Changing the file protection
Only the owner of a file or the system administrator may change a file's protection. This is done with the chmod command. To specify the protection changes, you identify the class(es) of users whose permissions you wish to change:
Next you indicate if you want to add or remove permission:
Finally, you indicate which type of permission you are adding or removing, using r, w, and x. So, if you want to change your files so that nobody else can read or execute them, you would say:
-> chmod go-rx *
Read the man page for chmod's section about specifying an absolute mode. Ignore the part about the setuid bit, the setgid bit, and the sticky bit for now (we'll talk about those in class next week).
User file-creation masks
Read the man page for bash and search for the paragraph about the umask builtin command. Cryptic, isn't it? Let's figure out what it's all about.
The Latest in Filesystems
One of the big developments in filesystems over the last several years is the development of ZFS by Sun Microsystems, now Oracle, and the subsequent release of the ZFS project as open-source software. At least one final project group will be exploring another, even more recent, file system.
Read this presentation about ZFS.
Submission and Evaluation
This lab will be graded out of 25 points (1 point per question except the last).
By 11:59 PM, Wednesday, April 20, 2016, submit your answers to the lab questions by email to terescoj AT strose.edu.