LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 02-21-2014, 01:34 AM   #1
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Rep: Reputation: 49
Files on samba share getting nobody rather than forced user from samba config


I have a samba file server, and I just ran a cron job which threw a LOT of can't set permissions errors, so I checked the folders, and somehow they have nobody as the owner user, but the group is correct. I have the following setup in smb.conf for the share. Did I do something wrong or miss a setting? I want the owner to be MyUser:MyGroup on anything the users copy up to the server.

force user = MyUser
force group = MyGroup
create mask = 0764
directory mask = 0776
writeable = yes
guest ok = yes
guest only = yes
 
Old 02-22-2014, 04:44 AM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by rjo98 View Post
I have a samba file server, and I just ran a cron job which threw a LOT of can't set permissions errors, so I checked the folders, and somehow they have nobody as the owner user, but the group is correct. I have the following setup in smb.conf for the share. Did I do something wrong or miss a setting? I want the owner to be MyUser:MyGroup on anything the users copy up to the server.

Code:
force user = MyUser
force group = MyGroup
create mask = 0764
directory mask = 0776
writeable = yes
guest ok = yes
guest only = yes
well, that was a tough one. This is formally okay, and at a cursory glance, it all looks correct. So I tried it out and got results similar to what you described: Files created in this share where owned by "nobody", but the group was set as desired. Weird. I have to add, though, that I've never used guest shares yet, let alone guest only.

After criss-crossing the Samba manual I found that the directives "force user" and "force group" conflict with "guest only". You can't use them together. Instead, you have to use the "guest account" directive to specify the Unix user in whose name a guest will access the files (no need to set the group explicitly then). That will replace both "force user" and "force group".

The default value for "guest account", by the way, is "nobody". Tadaa! ;-)

[X] Doc CPU
 
Old 02-22-2014, 08:00 AM   #3
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Great find! Thank you! What I was really trying to accomplish with my settings though was for people usinf both windows 7 and OSX to be able to connect to the share without being prompted for any credentials, for it to just log them into the share as that forced user and group.
So should I just remove the two guest settings then?
 
Old 02-22-2014, 11:17 AM   #4
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by rjo98 View Post
What I was really trying to accomplish with my settings though was for people usinf both windows 7 and OSX to be able to connect to the share without being prompted for any credentials, for it to just log them into the share as that forced user and group.
it was pretty obvious what you wanted. ;-)

Quote:
Originally Posted by rjo98 View Post
So should I just remove the two guest settings then?
I'm not sure if you meant the right thing here.
Just dump the two "force" directives (but keep "guest ok" and "guest only") and add "guest account = MyUser" instead. That should do the trick.

[X] Doc CPU
 
Old 02-22-2014, 01:06 PM   #5
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
At least I was clear haha

So if I set guest account on that share will that then put that owner and group I need on the files?
 
Old 02-28-2014, 01:54 PM   #6
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
It would set the group since that's the group the owner belongs to, right?
 
Old 03-01-2014, 05:10 AM   #7
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by rjo98 View Post
It would set the group since that's the group the owner belongs to, right?
yes, it sets the group to the chosen owner's primary one. I guess that's what you wanted anyway.

However, as you've seen with your initial config, the "force group" directive does take effect even though it probably isn't supposed to be. So if you need a different group to be set, you might still leave the "force group" directive there. I wouldn't like it, though.

[X] Doc CPU
 
Old 03-25-2014, 02:17 AM   #8
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Finally got some down time to do this. When I comment out the two forces and add
guest account = MyAccount
to the share section of the smb.conf, I get the following error from testparm and it doesn't work.

Global parameter guest account found in service section!

But if I add it to the global section, testparm is happy and when I copy a file in, it gets the proper user and group.

Why would it not work when I add it into the share section of smb.conf? I checked and guest account isn't anywhere else in the file.
 
  


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
Some folders created in Samba share get nobody as owner, rather than forced user anon091 Linux - Server 0 12-07-2013 07:45 PM
SAMBA - unix user created, added to samba, and valid users on share, still cannot... mitchell7man Linux - Server 12 03-17-2010 08:37 PM
Is there any way to log user samba who delete or move files/folders on samba server ? b-RAM Linux - Server 1 02-09-2010 12:33 AM
How to edit files with xemacs over Samba share? Samba problem? rylan76 Linux - Software 1 11-13-2008 01:00 AM
Samba :share files from home directory to an other user flashdelux Linux - Software 0 11-29-2004 12:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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