Saturday, December 6, 2008
7:15 AM

Default File Permissions on Creation - Umask

With the umask command you can set, what permissions a file will normally have when it's first created. It's a bit complicated, though: You have to XOR 666 for files and 777 for directories with the numerical permission code you want the file to have. (see man umask for more)

With umask you see the current mask, with umask -S you see it understandably. The default in Ubuntu is umask 022, which means that files will be -rw-r--r-- by default. With umask 026 you can prevent files from being readable and directories being accessible by "other"s (meaning anyone) by default (-rw-r-----).

You can also use the much easier symbols like with chmod, e.g. umask u=rwx.

0 comments:

Post a Comment