First step is to install the Samba package on the machine. Within your terminal prompt you will need to enter the following:
sudo apt-get install samba
Time to configure your Samba server. Samba has a main configuration file which is located in /etc/samba/smb.conf. The default configuration file has a significant amount of comments in order to document various configuration directives, so remember what you un-comment or change.
Within your terminal prompt type in the following:
sudo nano /etc/samba/smb.conf
First thing to edit is in the [global] section in the /etc/samba/smb.conf:
workgroup = EXAMPLE
security = user
The security parameter is farther down in the [global] section, and is commented by default. Also, change EXAMPLE to better match your environment – such as the domain name.
Now, go to the bottom of the smb.conf file and create a new section, or uncomment one of the examples, for the directory to be shared:
comment = Ubuntu File Server Share
path = /srv/samba/share
browsable = yes
guest ok = yes
read only = no
create mask = 0755
Note – If you wondering about the path – its the path to the directory to share.
Technically Samba shares can be placed anywhere on the file system as long as the permissions are correct, but adhering to standards is recommended.
Here is the break down of each attribute used to create the share folder:
browsable: enables Windows clients to browse the shared directory using Windows Explorer.
guest ok: allows clients to connect to the share without supplying a password.
read only: determines if the share is read only or if write privileges are granted. Write privileges are allowed only when the value is no, as is seen in this example. If the value is yes, then access to the share is read only.
create mask: determines the permissions new files will have when created.
Now that Samba is configured, the directory needs to be created and the permissions changed for your users to get access to your Samba share. From a terminal enter the following, but remember you can place the folder anywhere:
sudo mkdir -p /srv/samba/share
sudo chown nobody:nogroup /srv/samba/share/
The -p switch tells mkdir to create the entire directory tree if it doesn’t exist.
Finally, restart the samba services to enable the new configuration:
sudo restart smbd
sudo restart nmbd
That’s it you should be up and running with your Samba File Share Server.