Umask and file permissions
The umask is set when you log in, and is usually set in one of the default shell config files (like /etc/profile). You can override the umask for a particular user by setting their umask in the user’s shell profile, usually in “~/.bashrc”. The setting looks something like:
In the example above, the “2″ set for “group” and “other” means, instead of adding write permission to the created file, everything except write permission is added for those two categories. The “0″ means all permissions are set for the file owner.
The umask octal value is kind of the reverse of chmod permissions — you set it with an octal value, but instead of specifying the permissions you want the created file to have, you specify what you don’t want it to have.
You will sometimes see the umask expressed as four digits, like “0022“. Both styles work. That first digit is for setting some special permissions.
Leave a Reply
You must be logged in to post a comment.