Files on samba share getting nobody rather than forced user from samba config
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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! ;-)
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?
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
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.