Sunday, March 8, 2020

Samba - Xubuntu 18.04


SAMBA


Documentation


  1. Xubuntu 18.04 Documentation
  2. Ubuntu 18.04 - Ubuntu Desktop Guide
  3. Samba - Ubuntu 18.04
Websites - Installation & Setup instructions


STEPS


Install Samba
$ sudo apt-get install samba

Check installation success
$ whereis samba
Output should be: samba: /usr/sbin/samba /usr/lib/x86_64-linux-gnu/samba /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz /usr/share/man/man8/samba.8.gz
Create a directory to share
We will name the directory sambashare
We will place it in the /srv file system directory (as rumor has it, that the /srv directory is for server stuff, such as samba.
Change the permissions of the /srv directory so that you can work in it.
$ mkdir /srv/sambashare/
Edit the Samba config file to add the sambashare directory to Samba so it will be shared
$ sudo nano /etc/samba/smb.conf
This will open the config file in the terminal as an editable file.
You will be able to save your changes to it.
Scroll to the bottom of the config file and add the following lines:
[sambashare]
  comment = Samba on Xubuntu
  path = /srv/sambashare
  browsable = yes
  guest ok = yes
  read only = yes
  create mask = 0755
Save your config file before exiting.

Restart Samba
$ sudo service smbd restart

Open the Firewall to Samba traffic
It is important to open the server firewall to Samba traffic.
With UFW this is done by the command:
$ sudo ufw enable samba
This was a major roadblock to getting Samba to work on our home network.

Permissions to Access Sambashare
You can create Samba user accounts, or you can allow guest access. I left guest access, which is less secure depending on the environment.

Configure files in the /sambashare directory
I made myself the owner of everything starting with the /srv directory and recursively
I used the chmod 755 for /srv and for /srv/sambashare
Starting with the /sambashare directory, I made nogroup the other user (but I didn't use this recursively, and things worked fine).
All folders and files below sambashare use chmod 775 and have me as user and other.
I used the fstab file to add my music and audio folders to the /sambashare directory. (Note, it is possible to mount the same directly via fstab in more than one place.)