Official website for Linux User & Developer

Build a Samba file server

by Sukrit Dhandhania

How to build your own file server using Samba and Ubuntu with help from Linux User & Developer veteran, Sukrit Dhandhania…

This article originally appeared in issue 89 of Linux User & Developer magazine. Subscribe and save more than 30% and receive our exclusive money back guarantee – click here to find out more.

Samba is a Linux/UNIX software package that allows you to share files and directories with computers running other operating systems over the network. It also allows your Linux desktop or laptop to sign into a Windows network and be able to share files inside a workgroup. There are several advanced features that Samba comes with, such as domain controller. We will look at how to convert your Ubuntu box into a Samba file server and configure it to share directories with different combinations of permissions.

01 Prerequisites
When setting up a Linux file server, there are certain things that you will to have set up on your server before you start working on the Samba bit. The first thing you want to do is to set up the server with a static IP address, as opposed to one assigned dynamically by a DHCP server. Edit the file ‘/etc/network/interfaces’ with root user privileges and set the IP address manually. An example of the settings would be using something like the following:
[sourcecode language=”bash”]auto eth1
iface eth1 inet static
Using a static IP for any type of server makes good sense. Save the changes and restart the network with the command ‘# sudo /etc/init.d/networking restart’.

02 Installing Samba
Distributions such as Ubuntu have made the installation of just about anything so simple and straightforward with smart package management that you can have pretty much any software installed with a one-line command. To install Samba on your Ubuntu computer, execute the following:
[sourcecode language=”bash”]# sudo apt-get update
# sudo apt-get install libcupsys2 samba samba-common[/sourcecode]
Here we are requesting Ubuntu to install three packages. The first one is to share your printer, the other two are Samba and its support packages.

03 Configuration file
The configuration files of Samba are stored in the ‘/etc/samba/’ directory. The first thing you should do before we dive into the configuration of Samba is to make a backup of the main configuration file.
[sourcecode language=”bash”]# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak[/sourcecode]
Now open the file with your favourite text editor and let’s make some configuration changes:
[sourcecode language=”bash”]# sudo vim /etc/samba/smb.conf[/sourcecode]
Next Page
twitter follow us

Pages: 1 2 3 4 5 6
  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.