Create Temporary Samba Share

file-sharingsamba

Is there a possibility to temporarily share a directory per Samba?

With Python 3 i can serve the current directory per HTTP using:

python -m http.server.

I'd like to do the same thing with Samba.

Best Answer

There doesn't appear to be a way to create an ad-hoc share similar to the way exportfs does it for NFS on Linux and share does it on Solaris. Reasons may vary but you could technically do something like described in the page for Running Multiple Servers on the same machine and with the custom smb.conf accomplish what you need to do.

There is also an option to create and delete shares dynamically using SWAT, which will require changes to smb.conf to allow this to happen see sections on add share command and delete share command

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.

Related Question