Mini How To… Install and Configure Samba on Ubuntu


 

I cam across this brief tutorial on Liberian Geek and thought it explained what is sometimes considered a complicated subject very well so I decided to post a shortened extract in this blog, ignoring the Windows part of the tutorial

 

!

The tutorial assumes that the directory you wish to share does not exist so you create one called allaccess. If you already have a folder created you can modify the instructions accordingly.

1. Logon to Ubuntu server and install Samba and other tools. To install these packages, run the commands below.

sudo apt-get install -y samba samba-common python-glade2 system-config-samba

Next, create a backup of the existing Samba’s configuration file. To do that, run the commands below.

sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak

After that, create a new Samba config file with the global info below.

sudo nano /etc/samba/smb.conf

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = srvr1
security = user
map to guest = bad user
name resolve order = bcast host
dns proxy = no

Save the file.

At this point, we have our basic Samba configurations but no shares available. The [global] block above defines what workgroup the server belongs, what security levels is used and what NetBios name to display to clients.

For example, if you wish to share a folder where everyone has access and not security, then follow the steps below.

Create a shared folder called allaccess by running the commands below.

sudo mkdir /samba/allaccess

Then give all users access with full control. To go that run the commands below.

cd /samba

sudo chmod -R 0755 allaccess

sudo chown -R nobody:nogroup allaccess

Next, create a share block called [allaccess] in Samba configuration file as shown below.

[allaccess]
path = /samba/allaccess
browsable = yes
writable = yes
guest ok = yes
read only = no

The configuration file should now look like this:

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = srvr1
security = user
map to guest = bad user
name resolve order = bcast host
dns proxy = no
#============================ Share Definitions ==============================
[AllAccess]
path = /samba/allaccess
browsable =yes
writable = yes
guest ok = yes
read only = no

After saving the file, restart Samba using the command below

sudo service smbd restart

Now you should be able to access the share by browsing using Windows Files Explorer

Leave a comment