Configuration of Samba Server on Linux Machine

Overview

Samba is a popular open source program that allows end users to access and use files, printers, and other commonly shared resources on a company's intranet or on the Internet.

Samba is often referred to as a network file system and can be installed on a variety of operating system platforms, including: Linux, most common UNIX platforms etc.

Samba is based on the common Client/Server Protocol of Server Message Block(SMB) & Common internet file system (CIFS).

Scenario:

I this tutorial, i have used two systems one is Linux [Server] and other is Windows [Client].

For Samba Server:

  • Operating System: CentOS release 6.5 (Final)
  • Host IP : 192.168.1.50/24

For Samba Client :

  • Operating system : Windows 7 Professional
  • IP Address : 192.168.1.107/24

Now let's start with the installation and configuration steps on Samba Server [192.168.1.50]

Step 1: Install Samba Package

First, we are going to check is there samba package already installed on server or not? For that we used below rpm command which provides information about the already installed packages.

$ rpm -qa | grep samba

If you are getting blank output or no output which means you need to install package on server.

Run below command to install package,

$ yum install samba samba-client samba-common

Check Version,

$ smbd --version

Now we start the samba service and add samba service in chkconfig list.

$ /etc/init.d/smb start
$ /etc/init.d/nmb start
$ chkconfig smb on
$ chkconfig nmb on

Step 2 : Configure Samba Share

Before adding anything in smb.conf file take the backup of configuration file.

$ cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

Now empty the configuration file with below command and add the provided configuration inside the smb.conf file.

$ > /etc/samba/smb.conf

Before adding below lines, go to the Windows client machine and check the workgoup of client machine. Workgoup is important to connect to server on client machine.

To check Workgroup follow below steps.

Go to the Start-->Run-->enter "cmd"

Now run command "net config workstation". You will find the name of workstation copy this name and use under the samba configuration.

Come back to the server and open the "/etc/samba/smb.conf" file and add below lines in smb.conf file.

$ vim /etc/samba/smb.conf

#======================= Global Settings =====================


[global]

workgroup = MysGroup
security = share
map to guest = user

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

[MyShare]

path = /data/directoryname/
browsable =yes
writable = yes
guest ok = yes
read only = no

save the file and restart the samba service.

$ /etc/init.d/smb restart

Step 3 : Test Samba Share

Now go to the Windows client machine and Open the "Start-->Run". Enter ip of samba server with backward slash.

Refer below screens for more understanding.

samba user
scr2

I hope you like the article if you find any difficulties then please do comment your queries or problem via the comment section, till then stay tuned to techthings.org for more such valuable articles.

Leave a Reply

Your email address will not be published. Required fields are marked *