Roy Eastwood
2020-Dec-01 20:10 UTC
[Samba] Strange logs: check_usershare_stat: file /var/lib/samba/usershares/ owned by uid 0 is not a regular file
Thanks Andrew for your quick reply.
Here are the results of those commands:
root at lxd-m1:~# ls -l /var/lib/samba/usershares
total 0
root at lxd-m1:~# ls -l /var/lib/samba/
total 136
-rw------- 1 root root 421888 Jun 16 19:18 account_policy.tdb
drwxr-xr-x 1 root root 36 Jul 19 2019 DriverStore
-rw------- 1 root root 425984 Jul 19 2019 group_mapping.tdb
drwxr-xr-x 1 root root 98 Jul 19 2019 printers
drwxr-xr-x 1 root root 124 Jul 19 2019 private
-rw------- 1 root root 528384 Jul 19 2019 registry.tdb
-rw------- 1 root root 421888 Jul 21 2019 share_info.tdb
drwxrwx--T 1 root sambashare 0 Jul 19 2019 usershares
-rw------- 1 root root 32768 Dec 1 19:57 winbindd_cache.tdb
-rw-r--r-- 1 root root 421888 Jul 20 2019 winbindd_idmap.tdb
drwxr-x--- 1 root winbindd_priv 8 Nov 4 17:08 winbindd_privileged
root at lxd-m1:~# stat /var/lib/samba/usershares
File: /var/lib/samba/usershares
Size: 0 Blocks: 0 IO Block: 4096 directory
Device: 41h/65d Inode: 24656 Links: 1
Access: (1770/drwxrwx--T) Uid: ( 0/ root) Gid: ( 111/sambashare)
Access: 2020-12-01 19:00:10.120922818 +0000
Modify: 2019-07-19 12:14:08.718571118 +0100
Change: 2020-01-17 09:43:21.506782092 +0000
Birth: -
root at lxd-m1:~#
As far as I know I'm not using usershares. There are no usershare
directives in smb.conf which is as follows:
root at lxd-m1:~# cat /etc/samba/smb.conf
[global]
netbios name = lxd-m1
security = ADS
workgroup = MICROLYNX
realm = MICROLYNX.ORG
# disable smb1
client min protocol = smb2_02
server min protocol = smb2_02
log file = /var/log/samba/%m.log
log level = 1
# to prevent "Address family not supported by protocol"
messages (ipv6)
bind interfaces only = yes
interfaces = lo eth0
dedicated keytab file = /etc/krb5.keytab
kerberos method = secrets and keytab
winbind refresh tickets = yes
winbind use default domain = yes
# Default idmap config used for BUILTIN and local accounts/groups
idmap config *:backend = tdb
idmap config *:range = 2000-9999
# idmap config for domain MICROLYNX
idmap config MICROLYNX:backend = rid
idmap config MICROLYNX:range = 10000-99999
# next two lines for testing only - comment-out once working ok
# winbind enum users = yes
# winbind enum groups = yes
template shell = /bin/bash
template homedir = /srv/samba/users/%U
vfs objects = acl_xattr
map acl inherit = yes
store dos attributes = yes
username map = /etc/samba/user.map
[profiles]
# user profiles folder for roaming profiles
path = /srv/samba/profiles
read only = no
acl_xattr:ignore system acl = yes
vfs objects = btrfs
[users]
# user homedirs
path = /srv/samba/users
read only = no
acl_xattr:ignore system acl = yes
vfs objects = btrfs
# Recyle bin
recycle:repository = %U/Recycle_Bin
recycle:versions = Yes
recycle:keeptree = Yes
recycle:touch = Yes
recycle:exclude = *.tmp,~$*
recycle:exclude_dir = %U/Recycle_Bin
I don't see any other side effects - the box seems to be operating normally
as far as I can tell.
Regards,
Roy> -----Original Message-----
> From: Andrew Bartlett <abartlet at samba.org>
> Sent: 01 December 2020 17:28
> To: Roy Eastwood <spindles7 at gmail.com>; samba at lists.samba.org
> Subject: Re: [Samba] Strange logs: check_usershare_stat: file
/var/lib/samba/usershares/ owned by uid 0 is not a regular file
>
> On Tue, 2020-12-01 at 14:30 +0000, Roy Eastwood via samba wrote:
> > These logs:
> >
> > Dec 1 09:31:16 lxd-m1 smbd[26323]: check_usershare_stat:
> > file /var/lib/samba/usershares/ owned by uid 0 is not a regular file
> >
> > have started to appear this morning in sysvol. 25 such logs
> > appeared within a minute. No changes have been made for some time on
> > this machine. It's a member server running samba 4.13.2 on Debian
> > Buster. Is this a known bug?
>
> So first question: What is it?
>
> That is, Samba gives this error, so what does a manual shell inspection
with ls -l and stat etc give?
>
> Usershare functionality is configured via your smb.conf.
>
> Andrew Bartlett
>
> --
> Andrew Bartlett (he/him) https://samba.org/~abartlet/
> Samba Team Member (since 2001) https://samba.org
> Samba Team Lead, Catalyst IT https://catalyst.net.nz/services/samba
>
Jeremy Allison
2020-Dec-01 21:29 UTC
[Samba] Strange logs: check_usershare_stat: file /var/lib/samba/usershares/ owned by uid 0 is not a regular file
On Tue, Dec 01, 2020 at 08:10:52PM -0000, Roy Eastwood via samba wrote:>Thanks Andrew for your quick reply. > >Here are the results of those commands: > >root at lxd-m1:~# ls -l /var/lib/samba/usershares >total 0 >root at lxd-m1:~# ls -l /var/lib/samba/ >total 136 >-rw------- 1 root root 421888 Jun 16 19:18 account_policy.tdb >drwxr-xr-x 1 root root 36 Jul 19 2019 DriverStore >-rw------- 1 root root 425984 Jul 19 2019 group_mapping.tdb >drwxr-xr-x 1 root root 98 Jul 19 2019 printers >drwxr-xr-x 1 root root 124 Jul 19 2019 private >-rw------- 1 root root 528384 Jul 19 2019 registry.tdb >-rw------- 1 root root 421888 Jul 21 2019 share_info.tdb >drwxrwx--T 1 root sambashare 0 Jul 19 2019 usershares >-rw------- 1 root root 32768 Dec 1 19:57 winbindd_cache.tdb >-rw-r--r-- 1 root root 421888 Jul 20 2019 winbindd_idmap.tdb >drwxr-x--- 1 root winbindd_priv 8 Nov 4 17:08 winbindd_privileged >root at lxd-m1:~# stat /var/lib/samba/usershares > File: /var/lib/samba/usershares > Size: 0 Blocks: 0 IO Block: 4096 directory >Device: 41h/65d Inode: 24656 Links: 1 >Access: (1770/drwxrwx--T) Uid: ( 0/ root) Gid: ( 111/sambashare) >Access: 2020-12-01 19:00:10.120922818 +0000 >Modify: 2019-07-19 12:14:08.718571118 +0100 >Change: 2020-01-17 09:43:21.506782092 +0000 > Birth: - >root at lxd-m1:~#This is triggered by this code: if (!S_ISREG(psbuf->st_ex_mode)) { DEBUG(0,("check_usershare_stat: file %s owned by uid %u is " "not a regular file\n", fname, (unsigned int)psbuf->st_ex_uid )); return false; } but it should be looking at the files inside /var/lib/samba/usershares, not the /var/lib/samba/usershares directory itself. This is called from load_usershare_service(), which is passed the name of the share to find as a usershare. It looks like this is being passed an empty "" string.