I recently upgrading to Snow Leopard. I have noticed that some files written by MacPorts are installed with the wrong permission — they are written with a umask of 0077. I think I have narrowed down the problem:
- The
port
command is invoked viasudo
. - My
.bashrc
file specifies a umask of 0077. - On older versions of OS X (10.5 and below), sudo used the umask of the root user (which was 0022); however, now it uses my umask of 0077.
Is there anyway to have sudo
use the old behavior? Right now, it's kind of annoying because I have to use sudo
to run simple commands like port installed
, port outdated
, etc.
(The problem is described in more detail in this MacPorts ticket.)
Edit
I discovered the umask
option for sudo, and in /etc/sudoers
I added the following line:
Defaults umask=0022
However, this did not function as desired, because the real umask used by sudo
is the union of the user mask with this default mask. In order to override the behaviour of sudo
's umask and use the default directly (i.e., not the union of the user and default sudo mask), one can add the following:
Defaults umask_override
Best Answer
Mac OS X 10.7 (Lion) finally has a version of sudo that supports umask_override. For the record, this works for me: