[SOLVED] Mystery smb shares being served

Running 24.04.1 desktop, this is a system that has been through a few in-place release upgrades and I suspect this problem showed up between 22.04 → 24.04.

My computer is showing on the network as serving up Windows shares but I can’t figure out where they are being configured. The config is not in any of the smb.conf files I’ve found. (/etc/samba/smb.conf and /usr/share/samba/smb.conf) They are definitely being served up by smbd.service since if I stop this service the computer and shares are no longer visible on the Windows network. At this point I’m even running a grep across the entire system trying to see if I can find in a file a reference to one of the shares being served in hopes of tracking down where this is configured. What is it I’m missing?

Beyond that, I’m also not finding the tools I seem to remember for sharing out folders in the past. In the Gnome settings - sharing section there are only spaces to name my computer and share media. (I assume UPnP sharing) In Nautilus there is no longer the ability to right click on a folder and share it out. Solving this is not the priority, this is just an aside I can dig into more and/or ask about separately later. But I suspect once I understand where those other shares are being configured that will give me clues about where I need to go for adding new shares, or that it may be related to my main issue.

If this system has been through some distribution upgrades and you used to use graphical tools to make shares as a user, then the unexpected shares might be left over from using those tools. There is a command line tool named ‘net’ with a syntax similar to the ‘net’ command on the Windows command line. Try ‘net usershare list’ to see whether there are user defined shares and whether these are the ones you’re worrying about. If they are, ‘net usershare delete’ with the name of the share can be used to remove a user defined share.

You could also check your smb.conf for ‘usershare path’ in the section ‘[Global]’. The directory given in that option is where Samba stores the configuration for user defined shares.

1 Like

So ‘usershare path’ didn’t exist in the smb.conf files, but ‘net usershare list’ did show the two shares. ‘net usershare info’ gave me what I would assume is the full detail of each share’s configuration. There must be some default for user shares despite the fact that the USERSHARE section of the man page for net states:

and so on. This parameter definitely doesn’t exist in my smb.conf files. The parameter ‘usershare allow guests = yes’ does exist and is not commented out so this is probably what allowed the creation.

So now the search went on and I did a find of objects named ‘usershares’. Turned up /var/lib/samba/usershares and inside that directory were two files, matching the name of the mystery shares (although not by case) and containing the data necessary for samba to share them out. This is where samba chose to create the definitions. None of this looks to be a part of the samba registry, which I’m discovering is a thing.

So now that I’ve confirmed where these shares are coming from and that I can remove them I’m good to go about my business of planning out how I want to provide new shares and learning what my current options are to do so. Thanks @hdd-gehrke for getting me pointed in the right direction!