Share folder with Samba in Ubuntu 14.04 LTS

Install Samba Server

sudo apt-get install sambasamba-common libpam-smbpass

Test by typing smbstatus. If it shows any information about connected or not connected clients then it is working, if you get an error, it is not running or installed. Make sure you also have installed the libpam-smbpass package. It is used to sync system users with the samba database for cases like letting users connect to a resource while asking for a password.

sudo apt-get install libpam-smbpass
If you already have Samba installed with all needed packages then first edit the smb.conf file:

sudo nano /etc/samba/smb.conf
At the end of the file add the shared resource. In my case I will share a resource called “shareme”:

[shareme]
comment = Server Share Resource
path = /path/to/shared/resource
browsable = yes
guest ok = yes
read only = no
create mask = 0777

Save that and then exit the editor. Now restart the Samba service:

sudo service smbd restart

or

sudo /etc/init.d/smbd restart

The options above are:

comment – Shows the comments when browsing through a gui.

path – Folder you wish to share

browsable – Allows clients to see the shared resource when they use a file explorer (Like explorer on Windows or Nautilus on Ubuntu) .
guest ok – Allow user to connect to the resource without the need for a password.

read only – Sets a read-only permission so users don’t start going medieval on the shared resource.

create mask – When files/folders are created, this will be the permissions they will have set upon creation.. I left it like 777 which would be full to allow anyone to Read, Write or Execute, but if you don’t want somebody deleting something, set them to 0755.

This is a general explanation, which does not include a lot of security and user options. If you want, you can also read the Samba Guide or even jump to the Ubuntu Samba Guide

Other tips are (Which can be edited in the smb.conf file)

Make sure you are on the same workgroup (First option the samba config file)
If you start getting weird names on the shared resource, you can try adding the option mangled names=no to the Global section in the smb.conf file.
If users can see the shared resource but can not connect to it, even with the settings above, you can add/edit the option force user = YOUR_USER in the Global section which forces any resource to think the user connecting is you (Do not do this on a place you don’t trust).
To see all resources on the LAN network, you can use smbtree which would look like this:

XTREME
\\CYREX cyrex server (Samba, Ubuntu)
\\CYREX\img
\\CYREX\movies
\\CYREX\TVSeries
\\CYREX\print$ Printer Drivers
\\CYREX\IPC$ IPC Service (cyrex server (Samba, Ubuntu))

\\MARY mary server (Samba, Ubuntu)
\\MARY\temas
\\MARY\IPC$ IPC Service (mary server (Samba, Ubuntu))
\\MARY\print$ Printer Drivers
Lastly, in your question you mention you have a minimal GUI setup with Gnome. If the option to do all the sharing can be done via GUI, then you first need to install the following packages in order to have the option available when right clicking a folder (This may depend if you are using Unity/Files as the GUI or full Gnome/Nautilus as the GUI)

sudo apt-get install samba libpam-smbpass samba-dsdb-modules samba-vfs-modules python-samba samba-common-bin samba-common samba-libs nautilus-share libgnomevfs2-extra

After restarting, this should be enough to share via GUI and also be able to see shares. Again, in my case, I am testing this with Unity.

Source: askubuntu.com

Tags: