Posts tagged SAMBA

SAMBA logo

Setting up a server for home or small business | 2 – SAMBA print server, File Backups, Remote Desktop Connection

0

This is the second post about setting up a server for home or small business with SAMBA. If you haven’t seen the 1st post read it here :

http://blog.sanjaya.me/setting-up-a-server-for-home-or-small-business-1-configure-samba-file-server-with-ubuntu/

Printer sharing with SAMBA

I have already installed HP Deskjet 3920 printer in my server machine and enabled sharing. (Open “Printing” application >> Right click on the printer, see whether sharing is enabled).

Printers in Ubuntu

Printers in Ubuntu

 

As we are giving anonymous access to printers first create a user account for remote print jobs

 /usr/sbin/adduser --system --disabled-password smbprint

Then append the following lines to the end of the Global Settings.

printcap name = cups
printing = cups

And now we’ll share the printers. Add the following code to the end of the file

[printers]
browseable = yes
printable = yes
public = yes
create mode = 0700
guest only = yes
use client driver = yes
guest account = smbprint
path = /home/smbprint

Now your smb.conf file must look like 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
printcap name = cups
printing = cups

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

[printers]
browseable = yes
printable = yes
public = yes
create mode = 0700
guest only = yes
use client driver = yes
guest account = smbprint
path = /home/smbprint

Done! Restart the SAMBA services and check from a windows machine.

sudo restart smbd
sudo restart nmbd
Printer Shared

Printer Shared

 

So we are done with file printer sharing. Are we really ?

Try restarting the machine and see from the windows machine. Most of the times you won’t see printer there. If you restart SAMBA manually you will see it again. This happens because CUPS service is not started when samba is started while booting.

Fix for the problem “Printer not showing up until I restart SAMBA”

Give the following command.

 sudo gedit /etc/init/smbd.conf &

In the smbd.conf file just after pre-start script add the following line

sleep 10 
Editing smbd.conf File

Editing smbd.conf File

Now restart and see.

File Synchronization with Unison

To regularly backup the files I’m using Unison. Actually what I hope is getting the files synced from a source to a destination location in a particular time daily.

Get the GUI version installed easily using Ubuntu Software Center.

Open Unison and in the default profile give the source location as Root 1 and destination location as Root 2.

Unison default profile

Unison default profile

To automate Unison Backup we’ll create a scheduled task. Open the scheduled tasks app and create a new task. In the command give it like this.
 unison –batch default
Editing a Scheduled Task

Editing a Scheduled Task

Here “default” is the name of the profile you created in Unison.

As I want to do the run the file sync at 10AM every day I have set fields in the advanced section as shown in the image.

Setting up Remote Access

You may need to remotely log into this server using a windows machine. For that you can install xrdp.

sudo apt-get install xrdp 

(You can find more info on this from this article.)

Now open Remote Desktop Connection in the windows machine connected to the same network and give the hostname or the ip of the server machine.

Opening Windows Remote Desktop Connection

Opening Windows Remote Desktop Connection

Here if you find any problem connecting with Sesman-Xvnc module, select console module instead

Remote Desktop Connection

Remote Desktop Connection

 

So now you are almost done! It will be better to clone the drive of Ubuntu installation so you won’t need to do all these things again if ever system crashes. You can use CloneZIlla for that.

Enjoy using SAMBA!

SAMBA logo

Setting up a server for home or small business | 1- Configure SAMBA file server with Ubuntu

2

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.

 

Go to Top