LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-21-2009, 07:42 AM   #1
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Fedora 14, Ubuntu , Slax 5.1.8, OpenSolaris, Centos 4.8
Posts: 296

Rep: Reputation: 30
Permission to control read/write in Samba problem.


Hi there,
Utter confusion reigns !
Just some background first. Here is the ls -l output from the directory that I am sharing from my Samba server :

Code:
 $ ls -al

drwxrwx---  2 root   share  4096 2009-10-21 13:06 share
Note 770 permissions on the share directory.


The relevant part of the smb.conf file :
Code:
[linux-share]

path= /home/share

read only = no

 force group = share
 create mask = 0770
 force create mode = 0770
So any file created has 770 permissions and group owner is "share"
I have three samba accounts on the Samba server, myself (who is a member of the "share" group) , harry and max. Both max and harry are just ordinary users who have no login shell on the server, do not belong to any other groups and just have a samba login to upload files. Importantly, they are NOT in the share group.
The confusion arise when max and harry upload files.

(a) If the share directory is 770 owner root, group share, then why are they allowed to upload files? They are not in the group "share" and "other" does not have rwx permissions ???

(b) OK, so they can upload files and the files have 770 permissions as it states in the smb.conf, with owner being whoever uploaded the file and group being share. Below harry uploaded test.file. Here is the ls -l output :
Code:
[user@Linux /home]$ cd share
[user@Linux /home/share]$ ls -l
total *****
-rwxrwx--- 1 harry share       19 2009-10-21 13:27 test.file

[user@Linux /home/share]$
The file has inherited user( harry) ownership and group "share" as expected. The second problem is that when max logs into the share he can delete this file. How is this possible since he is not the owner of the file nor member of the "share" group ; /home/share (permissions 770) is owned by root and group owner is "share" and both max and harry do not belong to this group ?????

What I would eventually like is for both max and harry to be able to upload files but not read or delete each others files. The only person who should be able to read / write and delete other users' file is the person who belongs to group "share" i.e. me. I may have misunderstood permissions or have put the wrong permissions on the /home/share directory. A solution to this confusion would be highly appreciated !

cheers
C

Last edited by uncle-c; 10-21-2009 at 07:45 AM.
 
Old 10-28-2009, 07:26 PM   #2
fang0654
Member
 
Registered: Oct 2003
Location: New York, NY
Distribution: Ubuntu
Posts: 110

Rep: Reputation: 28
Your problem is this:

Code:
force group = share
From the man page:

Quote:
This specifies a UNIX group name that will be assigned as the default primary group for all users connecting to this service.
So everyone who authenticates to that share, is interacting with it as if they were in the group 'share', regardless of whether they are or not.

If you want to make it so any files uploaded by yourself keep the same group name as the parent, if you are using an ext3 filesystem, you can do the following:

Code:
chmod g+s /home/share
Any files created in that folder afterwards will keep the same group ownership as that folder.

Edit:

After a little more reading of the man page myself, I see you can also do this:

Code:
force group = +share
This will only have them act as 'share' if they are already a member of that group.

Last edited by fang0654; 10-28-2009 at 07:28 PM.
 
  


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
Why can I not write to a SAMBA share when read/write is enabled? eric m Linux - General 4 08-21-2006 09:22 PM
share read and write permission to users suguname Mandriva 3 01-18-2005 12:53 AM
Read and Write permission jing Linux - Newbie 3 07-13-2004 10:33 PM
Read/write permission skopje909 Linux - General 4 11-08-2001 02:41 PM


All times are GMT -5. The time now is 02:35 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration