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 -- Kind regards Hans du Plooy SagacIT (Pty) Ltd hansdp at sagacit dot com
On Monday 07 March 2005 18:55, 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?
I don't know if there is an easier way of doing it, but for detailed control of permissions like you want, I would write a small program using fam, that would monitor the directory and change permissions as required. I think I posted a program here that did something similar a year or so ago.
On Monday 07 March 2005 22:14, Anders Johansson wrote:
I don't know if there is an easier way of doing it, but for detailed control of permissions like you want, I would write a small program using fam, that would monitor the directory and change permissions as required. I think I posted a program here that did something similar a year or so ago.
Thanks Anders, I'll have a look in the archives (I keep them all on my PC...) The problem I have at the moment is, making the /var/spool/fax/recvq directory so that people can access the received faxes (the global ones, that is), and print copies some time down the line if they need to. But the faxes come out like this: -rw------- 1 fax uucp 124K Feb 24 08:16 fax000000155.tif So the normal users cannot read it. This is not the only application for a solution to this, just the current one - I've run into this problem before. -- Kind regards Hans du Plooy SagacIT (Pty) Ltd hansdp at sagacit dot com
On Mon, 7 Mar 2005 22:54:21 +0200, you wrote:
On Monday 07 March 2005 22:14, Anders Johansson wrote:
I don't know if there is an easier way of doing it, but for detailed control of permissions like you want, I would write a small program using fam, that would monitor the directory and change permissions as required. I think I posted a program here that did something similar a year or so ago.
Thanks Anders, I'll have a look in the archives (I keep them all on my PC...)
The problem I have at the moment is, making the /var/spool/fax/recvq directory so that people can access the received faxes (the global ones, that is), and print copies some time down the line if they need to. But the faxes come out like this:
-rw------- 1 fax uucp 124K Feb 24 08:16 fax000000155.tif
So the normal users cannot read it. This is not the only application for a solution to this, just the current one - I've run into this problem before.
There's a setting in faxsetup to allow you to change the permissions of received faxes. And for the non-fax paths, I do the same thing as Anders. Mike- -- Mornings: Evolution in action. Only the grumpy will survive. -- Please note - Due to the intense volume of spam, we have installed site-wide spam filters at catherders.com. If email from you bounces, try non-HTML, non-encoded, non-attachments.
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
participants (4)
-
Anders Johansson
-
Christian Andersson
-
Hans du Plooy
-
Michael W Cocke