LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 06-24-2004, 02:16 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
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?
 
Old 06-24-2004, 02:42 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 06-24-2004, 02:52 PM   #3
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
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?
 
Old 06-24-2004, 03:03 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 06-24-2004, 03:12 PM   #5
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
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.
 
Old 06-24-2004, 03:17 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 06-24-2004, 03:27 PM   #7
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
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.

 
Old 06-24-2004, 03:45 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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


Cheers,
Tink
 
Old 06-24-2004, 04:06 PM   #9
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
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::

 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Newly created File/directory permissions? redrobin77 Fedora 3 11-14-2005 04:55 AM
How to set permissions for newly created dirs? z-vet Linux - General 2 12-04-2004 08:06 AM
permissions for newly created files dialbat Linux - General 2 10-04-2004 02:58 PM
Why do my directory permissions not stick permanently? h00chman Linux - Newbie 3 03-20-2004 05:49 PM
directory permissions incorrectly set DutchBoy Linux - Security 3 01-05-2004 09:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration