11

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?

2 Answers 2

7

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:

net usershare add share_name /home/user/somefolder "Share description" everyone:F guest_ok=y

To make these shares permanent (i.e. persist over reboots) create a file for each share under /var/lib/samba/usershares/ like this:

net usershare info --long share_name > /var/lib/samba/usershares/share_name

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

1
2

You can edit /etc/samba/smb.conf and enter the share name, location, and who should access it. There are several examples in the file itself.

Here's online guide for entering new shares in the smb.conf file:

http://www.cyberciti.biz/faq/add-samba-share-in-linux-unix/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .