As part of the installation step of some software on a Ubuntu VM I'd like to create a samba share. How would I go about doing that from the command line?
Ubuntu – How to create a samba share from the command line
samba
samba
As part of the installation step of some software on a Ubuntu VM I'd like to create a samba share. How would I go about doing that from the command line?
Best Answer
Use Samba's net usershare command to share directories from the command line, IMHO this is less clunky and much safer than fiddling around in the main smb.conf file:
To make these shares permanent (i.e. persist over reboots) create a file for each share under /var/lib/samba/usershares/ like this:
This has a further advantage that if you're using a desktop like KDE or GNOME/MATE/Unity the directories will show up as shared in the file manager (Dolphin, Nautilus etc.). That's cause the net username//var/lib/samba/usershares/ thing is the same mechanism that Dolphin and Nautilus use when you share directories in the GUI.
See also: http://ubuntuforums.org/showthread.php?t=1659816