Home Media Server - Part 3 - Samba Configuration

As part of the file server set up, I've created a Samba share in order to facilitate easily adding files to it form other devices around the house.  It's not been plain sailing, and I'm still not convinced my setup is right, but here's the pain steps I went through using the terminal on Debian:

Log into the file server either directly or using SSH, and then log in to a terminal session as su so you can get admin privileges.

Install samba on the machine:

apt-get install samba

Select yes for installing the package and to accept it's going to use some disk space.

Create a folder for the samba shared folder in a location you want the files to be stored.  Note: if you have the OS on one disk and the main storage volume, you'll need to be a little careful here.  In my case, I did the following:

mkdir /var/samba

I then changed permissions on the folder to it was assigned to the group 'users':

chown :users /var/samba

Then I made the folder writable to members of the group

chmod g+w /var/samba

Then it was a case of setting up the samba share in the configuration file:

nano /etc/samba/smb.conf

and added the following lines:

[share]
comment = Hercules samba share
path = /var/samba
guest ok = yes
readonly = no
browsable = yes
create mask = 0777
directory mask = 0777

Once the configuration was completed and saved, it was then just a case of restarting samba:

service smbd restart
service mbbd restart

That was the share set up.  It was accessible from windows machines without issue, and could be mounted as a drive in linux by doing the following:

sudo mount -t cifs //hercules/share ./shared -o username=gary

From that (and the Samba config) you'll see my file server is called Hercules (it holds everything, so it must be strong...that was my logic).  I also have an empty folder called shared in my home directory where I mounted the drive, and told the share to use 'gary' as the username.  All that was needed was to type the password of the user from the file share when prompted.

Simple really, though I still think there's a better way than setting the directory and file masks to 777.