LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-14-2011, 03:14 PM   #1
Blackninja
LQ Newbie
 
Registered: May 2011
Posts: 2

Rep: Reputation: Disabled
How to set a group with default read & write permissions


Hey all, this is my first post as normally I'm usually able to find how to do something in a few searches but this has got me stumped:

What I want to be able to do, is have create a group, for example called "group1" and set its default permissions to read & write, instead of the usual just read.

So when I add a user into "group1" they automatically have read & write access to all files & directories which is in "group1".

Thanks in advance


Oh & I use crunchbang 10 (statler) for my desktops & Ubuntu 11.04 for my NFS/print/SSH/etc/etc server
 
Old 06-14-2011, 09:30 PM   #2
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
Okay, the first thing to understand is that you can't create a group
and set it to have default permissions.

Permissions are determined by the umask of the user who creates a
file. So if you want all members to have access to files which are
created, each of the members must have a umask that gives read and
write permission to the group. (Just ask if you have questions about
the umask command.)

The second thing to understand is which group will be associated
with a new file. If the SGID bit is set on the parent directory,
the file will be associated with the group of the parent directory.
If the SGID bit is not set, the group will be the user's group
that is included in the /etc/passwd file.

So...you can create a directory and set its SGID bit to make a
shared directory for a group. Then you'll just need to set the
umask for each member. Here is one way to accomplish this:

Code:
groupadd group1
mkdir -p /var/project/group1
chgrp groupadd /var/project/group1
chmod 775 /var/project/group1
chmod g+s /var/project/group1
gpasswd -a user1 group1
echo umask 002 > ~user1/.bash_profile
gpasswd -a user2 group1
echo umask 002 > ~user2/.bash_profile
Obviously this is an example that may need to be adjusted.
For example, your users may not use .bash_profile files.
If you have questions, be sure to post them.
 
1 members found this post helpful.
Old 06-15-2011, 08:29 AM   #3
Blackninja
LQ Newbie
 
Registered: May 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
thankyou, thankyou, thankyou.

The more I learn, the more I realise how little I know.

I set the group folder permissions to 3770, so only the owner can delete, whilst group members can create & read/write to files.

+rep - well deserved.
 
Old 06-16-2011, 08:18 PM   #4
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
Very cool. I'm glad to see you can run with this!
 
  


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
Group can read, write, but not delete pbwalker Linux - Security 2 10-15-2010 09:35 AM
[SOLVED] NFS share is mounted as read-only even if write permissions are set vofka Linux - Server 2 04-14-2010 06:09 PM
Giving user/group permissions to read&write Windows partitions? zaqwe Slackware 3 08-26-2007 11:07 AM
How do I set permissions on a group rwalkerphl Linux - Newbie 4 06-22-2004 04:44 PM
How to set permissions to read, execute, write for users only chupacabra Linux - General 3 12-18-2002 03:54 PM

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

All times are GMT -5. The time now is 01:09 PM.

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