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:
port
command is invoked via sudo
..bashrc
file specifies a 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.)
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
I ended up adding the following to my .bashrc
configuration script:
# Mimic old behavior of `sudo` on OS X Snow Leopard
sudo() {
old=$(umask)
umask 0022
command sudo "$@"
umask $old
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다