LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-18-2009, 02:16 PM   #1
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Rep: Reputation: 34
Question Changing permission on a folder so group users can Read and Write


Hi.
I was searching for this sometime now and didn't find any answer.

First of all I have to say that I know that I can just use the umask in /etc/profile so any file could be created with the mask set. But I need something that work only for this particular folder.

I have a shared folder used by some users:

rw-rw--- root:develop /home/share

and I want Bob and Joe to be able to write in this folder both belongs to group develop. Bob and Joe can write in the folder, but they can't edit each other files because every file created is made with the 022 umask and I need they goes with 006 (rw-rw---).

How can I solve this? Remember, seting a global umask isn't a good idea since I just need this kind of permission in this folder.


Thks [ ]'s
best regards
 
Old 03-18-2009, 03:49 PM   #2
Linville79
Member
 
Registered: Nov 2006
Location: Indiana, U.S.A.
Distribution: Red Hat Enterprise Linux, Fedora, CentOS
Posts: 134

Rep: Reputation: 16
setgid

I believe that you're looking for setgid which is applied using the chmod command. Setgid causes new files and subdirectories created within it to inherit its groupID, rather than the primary groupID of the user who created the file.

Code:
chmod g+s /home/share/
Note: This setting only affects new creations of files and subdirectories. Any existing files and subdirectories will have to be changed manually.
 
Old 03-19-2009, 01:32 AM   #3
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 666

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by Linville79 View Post
I believe that you're looking for setgid which is applied using the chmod command. Setgid causes new files and subdirectories created within it to inherit its groupID, rather than the primary groupID of the user who created the file.

Code:
chmod g+s /home/share/
Note: This setting only affects new creations of files and subdirectories. Any existing files and subdirectories will have to be changed manually.
While setgid directory (and umask = 002) technically solve the problem,
what is a reason in the first place for such setup ?

Usually it's mean than one have to use some kind of version control software.
 
Old 03-20-2009, 08:35 AM   #4
Linville79
Member
 
Registered: Nov 2006
Location: Indiana, U.S.A.
Distribution: Red Hat Enterprise Linux, Fedora, CentOS
Posts: 134

Rep: Reputation: 16
Quote:
Originally Posted by Valery Reznic View Post
While setgid directory (and umask = 002) technically solve the problem,
what is a reason in the first place for such setup ?

Usually it's mean than one have to use some kind of version control software.
That's a good point. If you have multiple developers that are working on the same set of files, it is far better practice to employ something like Subversion for source control where each developer can maintain their own trunks and then merge those into the production version as needed.

The best part of using a source control software, is that they provide automatic versioning, and allow for code rollbacks to previous versions if something gets broken.

The bottom line is, there are multiple ways to accomplish your goals, you just need to make sure that you're selecting the one that best fits your needs and your environment.
 
Old 03-20-2009, 08:40 AM   #5
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Original Poster
Rep: Reputation: 34
Okay, but this dont make the new files created under that folder to keep the folder mode, the files created are inheriting the umask mode in this case 022 wich doesnt solve my problem ...

see, I need the files to be created JUST in this folder with umask 006. If I do like Valery wrote I will have to set the umask for all files created by the user no matter where he creates it and this is something that I dont want.


[ ]'s
 
Old 03-20-2009, 01:45 PM   #6
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 666

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by maginotjr View Post
Okay, but this dont make the new files created under that folder to keep the folder mode, the files created are inheriting the umask mode in this case 022 wich doesnt solve my problem ...

see, I need the files to be created JUST in this folder with umask 006. If I do like Valery wrote I will have to set the umask for all files created by the user no matter where he creates it and this is something that I dont want.


[ ]'s
Could you explain what is this folder for ?

I never before faced situation when such arrangement was needed
 
Old 03-27-2009, 02:50 PM   #7
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Original Poster
Rep: Reputation: 34
Here we use a LTSP service and so everybody is using the same box as thin client server then when someone need to share something they use the share folder inside /home/share/sector. So I created a group for wich sector and those users of that sector inside it.

This is why I need something like this and could not comprimisse the default umask or I will be opening a way for the users see things that are not allowed.
 
Old 03-27-2009, 03:22 PM   #8
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 666

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by maginotjr View Post
Here we use a LTSP service and so everybody is using the same box as thin client server then when someone need to share something they use the share folder inside /home/share/sector. So I created a group for wich sector and those users of that sector inside it.

This is why I need something like this and could not comprimisse the default umask or I will be opening a way for the users see things that are not allowed.
I still don't get while you can't change default umask to 002.
Obviously it's OK for shared folder.
Where it'll create problem ? With users' home directories ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read/write permission to ALL users on a directory and everything in it Virtuality Linux - Newbie 3 12-13-2007 08:29 PM
how to give all users read/write access to a file in the Firefox profile folder 7trek Fedora 2 11-25-2007 05:09 PM
missing folder permission, owner and group tritonw Linux - General 4 10-28-2007 11:21 PM
share read and write permission to users suguname Mandriva 3 01-18-2005 12:53 AM
vfat partition - write permission for users group digitized_funk Linux - Newbie 8 03-19-2003 07:30 AM


All times are GMT -5. The time now is 08:16 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration