Managing access permissions with chmod, chgrp, chown, and umask
From the Beginning
The program umask specifies the default permissions assigned to newly created files and directories. Typing umask with no parameters shows the current setting:
$ umask 0022
What you see here is a four-digit octal number that specifies what to subtract from the default values (0666 for files, 0777 for directories). In other words, new files are assigned 0644 (rw-r- -r- -), and new folders are assigned 0755 (rwxr-xr-x) at the time that they are created.
To change the umask, enter the file and specify the new value at the command line:
umask 0077
This entry means that new files and directories are only available to their owner. To make new files writable for group members, you can choose umask 0002 instead.
The umask you assign in this way is valid for the current shell, but you can add an entry to your Bash configuration file ~/.bashrc to make the change permanent. Don't forget to run source ~/.bashrc to reload the Bash configuration file. To modify the umask for the system, you will need to add a global entry to /etc/profile, and you will need to work as root to edit /etc/profile.
« Previous 1 2 3 4 Next »
Buy this article as PDF
Pages: 4
(incl. VAT)