How to set the default file permissions on ALL newly created files in linux

4

My question is similar to this:

https://stackoverflow.com/questions/228534/linux-default-file-permission

but there is no scp/ftp client involved and that question looks abandoned. Simply put: I want to be able to, at some global level decree that all newly created files will never have world writable permissions (0775).

I tried putting a umask 02 in /etc/profile then in my bash_profile but it only works for scripts or new files that I create in a shell. It doesn't work for files that another binary creates. Is there anyway to have all new files that are created?

eviljack

Posted 2009-10-01T11:56:45.433

Reputation:

It's possible you may be able to do what you want by modifying the mount - either giving it a umask in /etc/fstab (umask=xxxx in the options section, but this is not available for ext*) or by chmod-ing the mountpoint. – Cascabel – 2009-10-01T13:49:09.343

Answers

1

umask is what you want...

sledge

Posted 2009-10-01T11:56:45.433

Reputation:

1

What you want is the UMASK setting in the /etc/login.defs file.

Teddy

Posted 2009-10-01T11:56:45.433

Reputation: 5 504

The description in my /etc/login.defs says: Umask which is used be useradd and newusers for creating new home directories. Doesn't sound like a global level decree for all services/ processes. – K B – 2013-02-22T09:07:18.423