Is there a possibility to temporarily share a directory per Samba?
With python3 i can serve the current directory per HTTP using:
python -m http.server.
I'd like to do the same thing with Samba.
There doesn't appear to be a way to create an ad-hoc share similar to the way
Personally if you want to have a share dynamic you might want to share your home directory and use dynamic home shares via samba discussed in many places including Ubuntu forums, and Samba mailing list.
Depending on how old your samba daemon is, and the config options used when it was built, you may still have the option of defining a "dynamic" share in your smb.conf, pointed at say /var/dynamic/, see below, and then simply adding a symbolic link to the directories you temporarily want to share into the directory.
This hack require the wide links option to be set to yes, to allow samba to follow links outside of the shares root. Unfortunately a couple of years back the Samba crew tweaked their default config to prevent wide shares, as it could be exploited. Google for: Samba and "wide links" for the history and work arounds.
A quick test should see if your good e.g.