SAMBA for Home or Small Business

First of all what is SAMBA? It’s a free File and Print server which can be used in Linux and UNIX based Oss for file and printer sharing with windows machines.

So now you got the idea. But why use Samba with Ubuntu? First it is free! When configured, works smoothly. Less need of worrying about viruses and many more advantages are there.

Here I’m using Ubuntu 12.04 desktop version in a pc with an Atom processor. The main aim is to setup a server which is only used for file/print sharing + backups. So here I’m not worrying about high end hardware. Also here I’m not considering security issues. File and printers are shared so anyone in the network have access to them.

Let’s go!

Auto mounting partitions in Ubuntu

In this machine I have created 4 partitions. First one for OS, second swap space, third for file storage, fourth for file backups. Last 2 partitions are not given mount points. So let’s do something to auto mount them at system startup. For this using pysdm is a good solution. Find how to do this here.

Auto Mounting partitions with pysdm

Auto Mounting partitions with pysdm

 

Installing SAMBA

Open a terminal and give the following command to install SAMBA and a gui tool.

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

File sharing with SAMBA

We can configure either using the GUI tool or editing the smb.config file. Let’s go for the second method. Give the following command in terminal

 sudo gedit /etc/samba/smb.conf &

If you wish you may backup this file first. Remove all the current content and add the following to this.

#===============Global Settings===========
[global]
workgroup = workgroup
server string = DI Server
; netbios name = DI-Server
security = share
map to guest = bad user
dns proxy = no
; encrypt passwords = yes
guest ok = yes
guest account = di

#===============Share Definitions===========

[DI Files]
path = /media/sda6/DI-Files
browsable = yes
writable = yes
guest ok = yes
read only = no
create mask = 0755

In global settings, you may already understand that workgroup is set as “workgroup”. You may change according to the workgroup you use in your network. “netbios name” is the name which you see this server in other machines when shared. Security is set to share. You can set this to user and restrict some access permissions. You may try it later.

Here I’m sharing /media/sda6/DI-Files folder so anyone in the network could have read and write access to that folder.

So you are done. Restart SAMBA services by giving following commands.

sudo restart smbd
sudo restart nmbd
Now using a windows machine connected to the network check whether you can access this folder. ( Go and see the workgroup computers)
Files Shared

Files Shared

 

Great!!! Try copying files and deleting them.

SAMBA GUI Tool

Adding shares can be done easily using the SAMBA GUI tool as. Search for SAMBA application (system-config-samba) and open it.

Playing with SAMBA gui tool

Playing with SAMBA gui tool

SAMBA GUI Tool | Set Permissions

SAMBA GUI Tool | Set Permissions

 

Now you are done with file sharing. In the next post we’ll look at Printer Sharing, Regular file backups and remote access to the Ubuntu machine using Windows Remote Desktop Connection.