Configure Home Server Samba Shares

Samba Shares

Before you configure Samba make sure to install Samba on Arch Linux or install Samba on Ubuntu Linux. Once the installation is completed it’s time to create the actual shares and configure access permissions. Samba boasts an overwhelming amount of configuration options but most are unlikely to be needed. Only a handful of options should suffice for simple home server configuration.

 

Edit samba configuration file.

sudo nano /etc/samba/smb.conf

Scroll down quickly by holding CTRL + V.

 

Configure Samba Global Defaults

Add the [global] special section that defines default options for all shares to the end of the file. Global options can be overridden by explicitly specifying options on individual share definitions. Most of the options can be omitted to use the default values. A few options are worth specifying explicitly for clarity.

[global]
workgroup = WORKGROUP
writable = yes
browsable = yes
security = user
map to guest = Bad User
guest account = nobody
guest ok = no

The default workplace is set to MYGROUP which as not very appealing. For a small home network with windows machines WORKGROUP is likely the simplest option because it is the default windows workgroup. To allow creation and modification of files writable option must be set to yes. Set browsable to yes to make the shares visible by default. The security option set to user requires a user to log-on with a valid password. This setting effectively disables any guest access to shares. To allow guests to access shares set map to guest option to Bad User which will map any invalid users to the guest user account. Specify a guest user account by setting guest account option to the username of an existing UNIX user account. You could create a dedicated guest user account or simply use a system account oddly named nobody. By Default you should disallow access by unauthenticated users by setting guest ok option to no.

 

Create Samba Custom Shares

Add any custom shares to the end of the file. The text in square brackets will be the name of the share that appears in network view.

[Movies]
path = /mnt/virtual/movies
inherit permissions = yes
inherit owner = yes

[Series]
path = /mnt/virtual/series
inherit permissions = yes
inherit owner = yes

[Music]
path = /mnt/virtual/music
inherit permissions = yes
inherit owner = yes

[Videos]
path = /mnt/virtual/videos
inherit permissions = yes
inherit owner = yes

[Pictures]
path = /mnt/virtual/pictures
inherit permissions = yes
inherit owner = yes

[Games]
path = /mnt/virtual/games
inherit permissions = yes
inherit owner = yes

[Software]
path = /mnt/virtual/software
inherit permissions = yes
inherit owner = yes

[Downloads]
path = /mnt/portable/downloads
inherit permissions = yes
inherit owner = yes

The path option sets the directory that will be shared. To force new files to have the same owner as the parent directory set inherit owner option to yes. Similarly, to also inherit permissions set inherit permissions option to yes.

 

Change current directory to the share directory.

cd /mnt/virtual

 

Create share directories.

mkdir {movies,series,music,videos,pictures,games,software,downloads}

 

 

Quick Reference

sudo nano /etc/samba/smb.conf
cd /mnt/virtual
mkdir {movies,series,music,videos,pictures,games,software,downloads}

Optionally also configure Samba home share and Samba public share.

Finish the installation of Samba on Arch Linux or Samba on Ubuntu Linux.

dom