Bugzilla – Bug 336
Umask taken from user instead of config file
Last modified: 2009-03-12 10:09:43 MDT
Recently it appears that sudo's behavior changed with respect to how it handles umasks. It used to ignore the umask of the user invoking sudo, but it now appears to OR the user's umask with the umask setting in the sudoers file. It does not appear to be possible to force a specific umask setting within the sudoers file; you're pretty much at the mercy of the user running sudo. For users with umasks of 0027 (or 0077) who are expecting file modes of 0644 after 'sudo touch somefile', this is a bit of a nasty shock. Resolution: revert to previous behavior, which worked as expected. Alternatively, allow for umask to be forced regardless of what the invoking user's umask happens to be.
The sudo umask setting exists to prevent users from creating file with an overly permissive mask. The change in behavior was to ensure that sudo never sets the umask to be more permissive than the user's. This is arguably more secure but I can see how it can cause usability problems for some people. I'll probably make the bahavior configurable in the next sudo release.
A umask_override option has been added to sudo 1.7.1. A beta version of sudo 1.7.1 may be downloaded from http://www.sudo.ws/devel.html