LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to permanently set permissions on all files created in a directory? (https://www.linuxquestions.org/questions/linux-general-1/how-to-permanently-set-permissions-on-all-files-created-in-a-directory-197268/)

BrianK 06-24-2004 02:16 PM

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?

Tinkster 06-24-2004 02:42 PM

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.


Cheers,
Tink

BrianK 06-24-2004 02:52 PM

Quote:

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?

Tinkster 06-24-2004 03:03 PM

Code:

  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.


Cheers,
Tink

BrianK 06-24-2004 03:12 PM

Quote:

Originally posted by Tinkster
Code:

  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.

Tinkster 06-24-2004 03:17 PM

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 ;)


Cheers,
Tink

BrianK 06-24-2004 03:27 PM

Quote:

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.

;)

Tinkster 06-24-2004 03:45 PM

Well, you COULD modify the source for nfs daemon and
client to accept a umask as a parameter ;)


Cheers,
Tink

BrianK 06-24-2004 04:06 PM

Quote:

Originally posted by Tinkster
Well, you COULD modify the source for nfs daemon and
client to accept a umask as a parameter ;)

HAHAHAHHAA!!! ahh... that's a good one.

::grumble::

;)


All times are GMT -5. The time now is 06:49 PM.