Directory Permissions and Mount Points

December 6, 2006

Here’s a good interview question for those looking to hire a UNIX systems administrator. For anyone versed in that OS, the answer should be immediately apparent.

Q: Explain the following:

donahuea@beta1.nyc:/var/opt> groups
staff donahuea
donahuea@beta1.nyc:/var/opt> ls -ld /var/opt
drwxr-xr-x   3 root     root         512 Dec  4 10:17 /var
donahuea@beta1.nyc:/var/opt> ls -ld /fs
drwxrwsr-x   5 root     root         512 Dec  4 11:53 /
donahuea@beta1.nyc:/var/opt> ls -ld /
drwxr-sr-x  34 root     root        1024 Nov 29 13:18 /
donahuea@beta1.nyc:/var/opt> cd ..
..: Permission denied.

A: /var/opt is a filesystem mount point, and the underlying directory for that mount point lacks the read and execute permissions for other users:

donahuea@beta1.nyc:/tmp> df -kFufs | grep /var/opt
/dev/dsk/c0t0d0s4    32275533   32025 31920753     1%    /var/opt
donahuea@beta1.nyc:/tmp> sudo umount /var/opt
donahuea@beta1.nyc:/tmp> ls -ld /var/opt
drwx------   3 root     root         512 Dec  4 10:13 /var/opt

Another relevant question here is, how can I look at the permissions of the underlying directory without having to unmount the filesystem which uses it as a mount point?

It’s not easy, but, on Solaris at least, my colleague and I discovered a way. He’s already posted a small note on it here.