Schedule
Labs
Assignments
TA office hours
Topic videos
Some course notes
Extra problems
Lecture recordings
Unfortunately, NFS has a number of issues, causing various degrees of trouble. The issue relevant to this assignment is that since the file permission and access information is all transmitted in terms of uids, strange things happen when the uids between two systems sharing files via NFS conflict.
It is not a problem if one system sees files owned by a uid which does not
exist locally.
In this case, ls -l
will simply report the uid number rather than a
name,
and no local user will gain inappropriate permission on that file.
The problem occurs when a uid number is in use on both systems, but in conflicting ways. For example, if user "fred" has uid 1024 on system "hosta", but user "barney" has uid 1024 on system "hostb", then fred's files on a filesystem NFS-mounted on hostb seem to be barney's. Barney has full owner access to these files. This is bad.
Well-maintained systems which share filesystems via NFS such as the teach.cs system employ some mechanism to ensure that uids are compatible between nfs-sharing computers in this way. Other sites may be chaotic and need periodic checking to ensure that there are no conflicts.
In this assignment you will write a tool called uidconflict to perform this conflict check. We are concerned with the first and third fields of /etc/passwd, which contain the logname and uid respectively. Write a shell script, probably using awk, which takes two command-line arguments representing files in the format of /etc/passwd, and diagnoses conflicts between the two files. The first argument can be "-" to indicate standard input. (A common use of your script would be "rsh hostb cat /etc/passwd | uidconflict - /etc/passwd".)
Conflicts are:
Conflicts do not include:
For easier processing with awk, you might want to use sed to add an extra field to each line of each file saying which of the two files it's from; then you can feed this whole thing as the input to your awk script and it can use $1 to identify which file the line is from.