This might not exactly solve your problem, but is a zsh trick I've used which works for a related problem in interactive shells. Creds to perf _at efd _dot lth _dot se. In $HOME/.zshrc: # Redefine umask to save it's arg (unless cwd is /usr/local/proj/*, # /usr/local/studorg* or ~/public_html*). This is done to allow # for chpwd() (defined below) to set the correct umask depending on # current working directory. umask () { if [[ $# -ne 0 && $PWD != /usr/local/proj*/* && $PWD != /usr/local/studorg/* && $PWD != ~/public_html* ]]; then _orig_umask=$1 fi builtin umask $* } chpwd () { if [[ $PWD = /usr/local/proj/* ]]; then umask 006 elif [[ $PWD = /usr/local/studorg/* ]]; then umask 006 elif [[ $PWD = ~/public_html* ]]; then umask 022 else umask $_orig_umask fi } /Ch Hans du Plooy wrote:
Hugo's question, and Patrick's answer (thanks) reminded me of something else I've been missing:
How do I set the umask for a certain directory? Say I have a directory, a samba share, say, of which the linux directory is /data
Now, lets suppose the samba/windows clients aren't the only people who put stuff in that directory, say I have a script that does backups or that downloads new versions of certain often used programs, that also goes there. Now I want everything in that directory to have permissions 444, regardless of who created and thus owns it.
How do I do that on a per-directory basis, below samba?
thanks