oh sorry, of course i have a typo in 6. The user usershare dir depends on system where samba was build. For example in fedora it is /var/lib/samba/usershares, and in openbsd it is /var/samba/usershares. I am sure i am doing everything right. пн, 5 нояб. 2018 г. в 19:10, Rowland Penny via samba <samba at lists.samba.org>:> On Mon, 5 Nov 2018 18:05:09 +0300 > Илья Коскин via samba <samba at lists.samba.org> wrote: > > > root:usershare > > > > пн, 5 нояб. 2018 г. в 14:44, Rowland Penny via samba > > <samba at lists.samba.org > > >: > > > > > On Mon, 5 Nov 2018 14:03:54 +0300 > > > Илья Коскин via samba <samba at lists.samba.org> wrote: > > > > > > > sorry for opening this thread again, but it looks like there is > > > > some bug in samba usershares. > > > > I successfully reproduced this bug in OpenBSD and in Fedora. > > > > > > > > Steps to reproduce: > > > > 1) Use default samba config. > > > > 2) Add options: > > > > usershare max shares = 5 (or else number) > > > > usershare allow guests = Yes > > > > 3) create usershares directory (personally i use directory path > > > > from testparm -v) > > > > 4) create group usershare and add target user to this group > > > > 5) chgrp usershares dir to usershare group > > > > 6) chown 1770 usershares dir > > > > 7) create usershare with: net usershare add > > > > share /home/user/share "" Everyone:F guest_ok=y > > > > > > > > 8) try to access server with any client like windows or linux and > > > > voila: [2018/11/05 13:53:02.185034, 0] > > > > ../source3/param/loadparm.c:3560(load_usershare_service) > > > > load_usershare_service: stat of /var/samba/usershares failed. > > > > Permission denied > > > > > > > > > > Apart from number 6 which I feel is a typo (chown should be chmod), you > seem to be doing everything correctly. The only problem I can see is > that you said you use the default usershares path. The default path > is /var/lib/samba/usershares, but the error message has > /var/samba/usershares, which are you using ? > > Rowland > > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba >
On Mon, 5 Nov 2018 19:32:29 +0300 Илья Коскин via samba <samba at lists.samba.org> wrote:> oh sorry, of course i have a typo in 6. > The user usershare dir depends on system where samba was build. > For example in fedora it is /var/lib/samba/usershares, > and in openbsd it is /var/samba/usershares. > I am sure i am doing everything right. >Yes, I think you are too. The error message you are getting comes from here: if (sys_stat(usersharepath, &sbuf, false) != 0) { DEBUG(0,("load_usershare_service: stat of %s failed. %s\n", usersharepath, strerror(errno) )); return -1; } Which, to my limited understanding of 'C', means it checks if 'stat' can be run successfully against the usersharepath and it doesn't look like it can. Not sure who 'stat' is being run as ? Is it root, if so it should work. Is it an authenticated user who is a member of the group usershare, if so, it should work. It could however be a guest user, which would make the actual user 'nobody' who probably isn't a member of the group 'usershare' (I hope) and this user will not be able to run 'stat' on the usershare directory. Finally, it could be an authenticated user, who isn't a member of the 'usershare' group, again, this user wouldn't be allowed to run 'stat' on the share directory. I could of course have missed the point all together and be totally wrong. Rowland
Thank's for pointing me here, looks like adding 'nobody' to usershare group "solve" the problem for me :) Logs is now clean! Is there any security or other reasons, why i am better not to do so? пн, 5 нояб. 2018 г. в 20:09, Rowland Penny via samba <samba at lists.samba.org>:> On Mon, 5 Nov 2018 19:32:29 +0300 > Илья Коскин via samba <samba at lists.samba.org> wrote: > > > oh sorry, of course i have a typo in 6. > > The user usershare dir depends on system where samba was build. > > For example in fedora it is /var/lib/samba/usershares, > > and in openbsd it is /var/samba/usershares. > > I am sure i am doing everything right. > > > > Yes, I think you are too. > > The error message you are getting comes from here: > > if (sys_stat(usersharepath, &sbuf, false) != 0) { > DEBUG(0,("load_usershare_service: stat of %s failed. %s\n", > usersharepath, strerror(errno) )); > return -1; > } > > Which, to my limited understanding of 'C', means it checks if 'stat' > can be run successfully against the usersharepath and it doesn't look > like it can. > > Not sure who 'stat' is being run as ? > Is it root, if so it should work. > Is it an authenticated user who is a member of the group usershare, > if so, it should work. > It could however be a guest user, which would make the actual user > 'nobody' who probably isn't a member of the group 'usershare' (I > hope) and this user will not be able to run 'stat' on the usershare > directory. > Finally, it could be an authenticated user, who isn't a member of the > 'usershare' group, again, this user wouldn't be allowed to run 'stat' > on the share directory. > > I could of course have missed the point all together and be totally > wrong. > > Rowland > > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba >