Dave, I know you can’t solve trivial questions for everyone, but if you could have someone help me with the umask command and the content on pp. 107-109 of your book Teach Yourself Unix is 24 Hours, I’d appreciate it. I’ve taken two hours to try to figure out how in the world umask 277 produces a read-only file. It seems to me it would be write only. Can you shed some light on this, please?
Thanks for your note. Your quesiton isn’t trivial (but if it were, I’d suggest you pop over to the fun site Trivial.Net, but that’s another story entirely!)
In terms of umask, you need to look at things backwards…
When you see a umask of 277 it’s the same as a pattern of -x- xxx xxx, right?
Now, since it’s a umask you need to INVERT that to figure out how it turns into an actual permission string. That makes it x-x — —.
To make this a bit more complex, remember that the touch command shown in the book example that’s stumped you can only give you read or write permissions, so that’s kinda/sorta another mask.
All that’s left is r– — — and that’s exactly what permission you get.
Here’s the actual example out of the book that you’re asking about:
$ umask 277 $ touch testfile.277 $ ls -l testfile.277 -r-------- 1 taylor staff 0 16 Dec 22:44 testfile.277 $
Got it now?