0

I'm trying to set the default permissions on my Ubuntu installation. I'd like all files created to have 755 permissions. Currently, they have 666, even though I have my umask set to 000.

Example:

$ umask
0000
$ touch tmp.txt
$ ls -l tmp.txt
-rw-rw-rw- 1 <name> <name> 0 2009-11-16 19:41 tmp.txt

I also have my etc/profile set to umask 000. Is there anywhere else this setting might live?

  • 2
    Why do you want those permissions? What problem are you trying to solve? Having each and every file created with 777 permissions is certainly not a good idea. – innaM Nov 16 '09 at 20:15
  • I'm write a fair number of scripts, and I'd like to be able to have them executable on creation. Additionally, when I do my svn checkout, it appears to revert a lot of the permissions on my scripts in the repo, and I'd like the default to be less restrictive.

    I don't necessarily want to leave it at 777, and I'd probably set the umask back to something more restrictive. In the meantime, though, I just wanted to know how it worked.

    –  Nov 17 '09 at 00:02
  • 1
    If you use emacs or vi, there are ways to have them automatically mark any file executable when you save it if it starts with a #!shebang. – Ryan C. Thompson Nov 17 '09 at 06:09

1 Answers1

3

No. Files by default will not receive execute permissions no matter what the umask is. This is a security feature. If you want any files to have execute permissions you will have to explicitly set that with chmod.

666 is

rw-rw-rw-

as you can see the x bit is missing from the owner, group, and other's permissions (which is worth 1).

directories can receive 777 with a 000 umask because executing a directory allows you to change into it. This doesn't impose a security risk like executing files (scripts, binaries, etc).