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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-09-2009, 05:56 PM
|
#1
|
|
Member
Registered: Jan 2006
Distribution: Slackware
Posts: 378
Rep:
|
how to share files and directory without group and world access
I want to set up a directory where users from different groups can share files. They all need to be able to view the directory contents, read or edit files, create new files, etc.
These users are in different groups. I don't want to grant world access to the directory or to the files. I want the other access bits set to 0 for the directory and all files created in it.
Is there any way to do this?
|
|
|
|
08-10-2009, 10:57 AM
|
#2
|
|
Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092
|
Why don't you just create a new group for that directory and then only add those people who need it to the group?
|
|
|
|
08-10-2009, 11:39 PM
|
#3
|
|
Member
Registered: Jan 2006
Distribution: Slackware
Posts: 378
Original Poster
Rep:
|
I'm not sure I understand. These users already have a group association, each one different, and they need to remain part of their current group.
|
|
|
|
08-11-2009, 12:20 AM
|
#4
|
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 3,965
|
An user can belong to as many groups as you need. What you want is to create a new group, let's calle it "my_group", and then add all the relevant users to that group. Then make the following:
Code:
chown root:my_group /whatever/dir
chmod 770 /whatever/dir
If you are mounting something into that directory, then the ownerships and permissions might depend (or not) in the mount options, only for some fs's.
Last edited by i92guboj; 08-11-2009 at 12:27 AM.
Reason: corrected chown command
|
|
|
|
08-11-2009, 12:26 AM
|
#5
|
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 3,965
|
An user can belong to as many groups as you need. What you want is to create a new group, let's calle it "my_group", and then add all the relevant users to that group. Then make the following:
Code:
chown /whatever/dir root:my_group
chmod 770 /whatever/dir
If you are mounting something into that directory, then the ownerships and permissions might depend (or not) in the mount options, only for some fs's.
|
|
|
|
08-11-2009, 12:29 AM
|
#6
|
|
Member
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 549
Rep:
|
You know there is concept of primary and seconday group, a user can belong to one primary but many seconday group. Create a group for that folder, and make users member of that group. Make that group owner of that folder and assign SGID bit to that folder.
#groupadd <nameofgroup>
#chown root:<nameofgroup> path to folder
#chmod g+s <path to folder>
#gpasswd -a <nameofuser> <nameofgroup>
#gpasswd -a <nameofuser> <nameofgroup>
...
Thanks
|
|
|
|
08-11-2009, 07:54 PM
|
#7
|
|
Member
Registered: Jan 2006
Distribution: Slackware
Posts: 378
Original Poster
Rep:
|
Thank you. I must be doing something wrong though, because it doesn't seem to work. The users still get permission denied.
Code:
sar@batcave:/home$ id -a
uid=1002(sar) gid=103(r) groups=7(lp),11(floppy),17(audio),18(video),19(cdrom),83(plugdev),93(scanner),103(r),222(share01)
sar@batcave:/home$ cat /etc/group | grep share01
share01:x:222:sar,fcv,rxf
sar@batcave:/home$ ls -al
...
drwxr-s--- 10 root share01 4096 2007-07-11 03:58 share/
sar@batcave:/home$ cd share
sar@batcave:/home/share$ touch x.y
touch: cannot touch `x.y': Permission denied
|
|
|
|
08-11-2009, 10:40 PM
|
#8
|
|
Member
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 549
Rep:
|
Your group doesn't seem to have write permission
use
:/home$chmod 775 share
thanks
|
|
|
|
08-11-2009, 10:49 PM
|
#9
|
|
Member
Registered: Jan 2006
Distribution: Slackware
Posts: 378
Original Poster
Rep:
|
That did it. I don't know how I managed to overlook that. Thank you vishesh.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:46 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|