[Samba] Strange logs: check_usershare_stat: file /var/lib/samba/usershares/ owned by uid 0 is not a regular file

Jeremy Allison jra at samba.org
Wed Dec 2 17:46:23 UTC 2020

On Wed, Dec 02, 2020 at 09:54:16AM +0000, Rowland penny via samba wrote:

>OK, I have realised why this is happening, but not how (or is that 
>how, but not why ?)
>I set 'profilePath' to '//raspberrypi/profiles' in my AD object, 
>unfortunately the 'raspberrypi' that is running now isn't the same one 
>that was running when I set it and it doesn't have a profiles share. 
>The question has to be, is this a Samba problem, or is it a Windows 
>problem ? To me, it seems that Windows looks for the profile and 
>having not found it, searches on 'raspberrypi' for it, so should 
>Windows be doing this and should Samba be allowing this ?

We can't control clients asking for anything unfortunately.

OK, I see the problem. There are two paths into process_usershare_file.
One is the directory scanner. But the second one is if a client asks for an unknown
share and usershares are enabled it calls:


- we end up in process_usershare_file() and go into the path:

         if (sys_lstat(fname, &lsbuf, false) != 0) {
                 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
                         fname, strerror(errno) ));
                 goto out;

A debug level zero is a valid thing to do if we're processing a name
from the directory scanner, but not from an unknown share.

Fix is to bump this debug to DBG_INFO. If there really was
a problem and we're coming in from the directory scanner,
then we'll end up in check_usershare_stat() and the admin
will get notified that way.

Rowland, can you log a bug and I'll create a patch MR
for this ?



More information about the samba mailing list