LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-08-2005, 02:13 AM   #1
sharp81
Member
 
Registered: Mar 2005
Posts: 79

Rep: Reputation: 15
samba permissions


I have a problem with samba file and group share permissions.

The problem is as follows :

I have 10 users and 5 groups who all need to access the samba share

The root folder of samba has permissions for group A.

While the sub-folders have permission for other groups for each sub folder.


The problem i am facing is when some one writes from windows or even linux the permissions get changed to the particular user and some other groiup ..... so each time i need to keep changing the permissions .... is there any way in samba that can be configured so that the permissions remain intact even if some one creates a file or a folder ...

Please help

Sharp
 
Old 07-08-2005, 08:51 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Use create mask = in the config for umask and permission settings

Example:

create mask = 0775

Or use force create mode =

Example:

force create mode = 0755

And if all the users are part of the same group with permissions to write files, etc, use force group

Example:

force group = groupname

You can also force users with force user =

Example:

force user = username

You can see a list of all options by reading the smb.conf man page:

man smb.conf
 
Old 07-10-2005, 01:09 AM   #3
sharp81
Member
 
Registered: Mar 2005
Posts: 79

Original Poster
Rep: Reputation: 15
I have set those options but stilll have problems .......

I will try put my problem in detail

I have share named share_1.

It has sub-folders with names sub_1,sub_2,sub_3,sub_4

The users are user_1,user_2,user_3,user_4,user_5,user_6,user_7,user_8

users user_1,user_2 need to have r+w+x access to all the share and all the sub-folders.

while user_3,user_4 can have rwx access to only sub_2
user_5,user_6 for sub_3
user_4,user_7,user_8 for sub_4
user_1,user_2,user_8 for sub_1

though user_1 and user_2 can access all the folders with rwx

I have created each set as groups and added the reqd users with grp_1,grp_2,grp_3, and grp_4

everything turns out to be proper except when some one from the particular grp creates a new file/edit's a file the permission changes such that only he can do the modifications.

As well as the root directory of share_1 does not allow user_2 even though the permission is set to 775 for that folder.

my question is why is the permission changing and how can i rectify this.

sharp
 
Old 07-10-2005, 10:03 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Probably the only work around I know of is that you'll need to setup a separate shares thru samba for those to access the sub directories and then those users will see such shares, etc.
 
Old 07-11-2005, 01:40 AM   #5
sharp81
Member
 
Registered: Mar 2005
Posts: 79

Original Poster
Rep: Reputation: 15
Can you tell me why the share root directory keeps changing the permission from 775 to 755 ? and how to fix that .... i did chmod but it changes back to 755 after sometime ..... i am confused
 
Old 07-14-2005, 11:48 AM   #6
sharp81
Member
 
Registered: Mar 2005
Posts: 79

Original Poster
Rep: Reputation: 15
Thanks for all your help .....

I figured it out myself

It was the msec that i needed to change the permissions in the perm.* file

Also for the samba share problem i just need to chmod with the group id so that the group permission remains intact

find path/to/share -type d print0 | xargs -0 chmod g+s

Explanation:
find = the find command, which finds files matching
criteria
/path/to/share = any directory where you want to apply
inheritence
-type d = Directories
-print0 = Print with no newlines, for xargs to read
| = run this command on the output
xargs = run a command on each line input
-0 = data comes in with no newlines
chmod = change mode
g+rwxs = read, write, execute (browse), and set group
id

Then you chgrp all files:
chgrp -R /path/to/share
Explanation:
chgrp = change group of the files/folders
-R = Recursive

Finally, add members to your group:
gpasswd -a <user> <group>
Explanation:
gpasswd = the group password command, but we're not
setting a password here
-a = Add

Have the users log out and back in again to take
effect.

>From then on, all files created in that directory will

be in the same group. The user doesn't truly matter,
as long as you have at least ---r-x--- for group
read-only directories, ---rwx--- for group writeable
directories, ---r----- for group readable files,
---rw---- for group writeable files. At least those
permissions. You could then safely remove "other"
permissions to prevent a breech in security, as
everyone should be in that group to have access.

This is also useful with Winbind and "winbind use
default domain = yes" in smb.conf. I can create a
group:

groupadd smbwrite

Add some users from my NT domain into it:

for USER in chris steve mike; do
gpasswd -a $USER smbwrite
done

Set my permissions:

find /share/mis -type d -print0 | xargs -0 chmod g+s

And then set the group ID:
chgrp -R smbwrite /share/mis

Also, sgid is the 2 bit in the first number of octal
permissions (e.g. chmod 2770 some_directory).

Don't forget to have your users log out before trying,
and good luck.


I shld thank google groups for this ...... I dont the name of the person otherwise i would have included his name here as well .... he deserves the credit for this

Sharp
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
samba and permissions aylov Linux - Networking 2 04-29-2005 03:28 AM
Samba Permissions? ezra143 Linux - Networking 1 02-22-2005 01:26 PM
SAMBA says 'Samba Server is not accebile, you might have no permissions' Ahmad Gurchani Linux - General 1 01-01-2005 10:34 AM
Samba and permissions ezra143 Linux - Software 8 11-05-2003 05:39 PM
Samba permissions djtsa Linux - Newbie 6 10-03-2003 07:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:53 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