How to permanently set permissions on all files created in a directory?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to permanently set permissions on all files created in a directory?
I have one directory in which I would like everyone in group "foo" to be have read & write permissions.
Is there a way to do that? I know I can "chmod -R g+rw dir", but that doesn't cover any new files created in that directory.
I could set each user's umask, but that umasks the everything - not just the one directory.
If it helps, the directory in question is an NFS mount (nfs does not have any sort of options that allow this to happen - at least to the best of my knowledge).
ideas? Is there some way a sticky could help me? If so, how?
The question is how you've set-up the NFS share ...
If you're all_squashing there's nothing you can do.
If you're not, all you need is to make foo the default
group of the users you want to read/write and have
both the mountpoint and the exported directory
owned by foo.
Originally posted by Tinkster The question is how you've set-up the NFS share ...
If you're all_squashing there's nothing you can do.
If you're not, all you need is to make foo the default
group of the users you want to read/write and have
both the mountpoint and the exported directory
owned by foo.
not using all_squash.
The way I understand it, in order to assign gid through nfs export is to force everyone to mount as anonymous & then map the anongid to foo. While this *does* work, it's a bit more heavy handed than I'd like - I'd rather the owner owned the file & show up when you long list.
Am I understanding this wrong? Can you map all connections to a gid without mapping the uid?
User ID Mapping
nfsd bases its access control to files on the server
machine on the uid and gid provided in each NFS RPC
request. The normal behavior a user would expect is that
she can access her files on the server just as she would
on a normal file system. This requires that the same uids
and gids are used on the client and the server machine.
This is not always true, nor is it always desirable.
It may not be always desirable (specially if you were exporting
to the internet ;}) ... but it works fine for me, my uid/gid is
identical on both the nfs server and the local workstation.
User ID Mapping
nfsd bases its access control to files on the server
machine on the uid and gid provided in each NFS RPC
request. The normal behavior a user would expect is that
she can access her files on the server just as she would
on a normal file system. This requires that the same uids
and gids are used on the client and the server machine.
This is not always true, nor is it always desirable.
It may not be always desirable (specially if you were exporting
to the internet ;}) ... but it works fine for me, my uid/gid is
identical on both the nfs server and the local workstation.
That is the way my current system is setup, however, it does not force new files created to be created with group permission. I'm sure this is because my default umask is 22. I can set my default umask to be 7 (or 2, I suppose), but that sets it everywhere... I'd rather do it for just this one directory.
The only (ugly and not necessarily reliable) way of working
around that would be to have a cron-job on the server run
every minute and set the permissions ;)
Originally posted by Tinkster Oic ... that's not possible, I'm afraid.
The only (ugly and not necessarily reliable) way of working
around that would be to have a cron-job on the server run
every minute and set the permissions
WOW!! that's horrid.
oh well, I guess my users will have to deal with umask 002.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.