There's 2 ways to create a samba share:
* Classic-share uses smb.conf and it's shares are defined there. I don't know if there is a way to create a share from a terminal for these shares.
* Usershares also uses smb.conf but it's shares are defined in /var/lib/samba/usershares. These can be created from a terminal although the syntax is very awkward:
Let's say I wanted to create a guest writeable share of my Documents folder:
To make it Read Only change "everyone:F" to "everyone:R"
net usershare add documents /home/morbius/Documents "morbius documents" everyone:F guest_ok=y
To make it a private share vs a Public share change "guest_ok=y" to "guest_ok=n"
Usershares don't have the flexibility and configurability of a classic share but depending on your needs it might be enough.
The command to delete the Usershare I created above:
And the command to get a list of how all your usershares are configured:
net usershare delete documents
net usershare info --long