Connect with us

Hi, what are you looking for?


How to configure Samba Server on CentOS 7

What is Samba?

Samba is open source software and it uses the TCP / IP protocol. Basically the samba is an implementation of SMB (server message block) and CIFS (common internet file system) protocol. The main advantage of samba is it provide file and print sharing services between Linux and Other O.S.

Samba supported platforms:

  • Linux
  • Windows
  • Solaris 2.above
  • Aix
  • OpenBSD
  • SunOS 4 above
  • and more…..

Samba Packages Quick Review

  • samba
  • samba-client
  • samba-common
  • samba-winbind
  • and some others

Configure SAMBA server for RHEL/CentOS/Scientific/Oracle Linux 7/6/5

STEP 1: Now check whether your yum is configured.
STEP 2: Check Necessary RPM’s
[root@techbrown ~ ]# rpm –qa samba
STEP 3: Install necessary RPM
[root@techbrown ~ ]# yum install samba* -y

The samba packages are installing now.

SAMBA Daemons:

nmbd: The nmbd daemons provides NetBIOS (Network Basic Input/output system) nameserving and browsing support. A daemon that looks after the Windows Internet Name Service (WINS) and assist with browsing. But according to samba documentation, it should be the first daemon to start.
Smbd : It manages file transfers and authentication.
Winbind : It started to handle Microsoft Windows Domain membership.

To check status

[root@techbrown ~]# service nmb status
nmbd is stopped
[root@techbrown ~]# service smb status
smbd is stopped
[root@techbrown ~]# service winbind status
winbind is stopped

Configuration File:

The main configuration file is smb.conf and the path of configuration file is /etc/samba/smb.conf.
It is divided into four sections:
global : General samba configuration parameters.
homes : Allow users to access their home directories.
printers : Used for configuring printers and printers entries related to shared printers.
shares : Define other shares available.

STEP 4: So let’s start to configure SAMBA server on server side.

We share /techbrown file. So first create a /techbrown directory and create some files into /techbrown directory.

Advertisement. Scroll to continue reading.
[root@techbrown ~]# mkdir /techbrown
[root@techbrown ~]# touch /techbrown/file {1..10}

Now we edit configuration file of samba and make some changes and entries in it.

[root@techbrown ~]# vim /etc/samba/smb.conf

You can change a WORKGROUP from the global section.
Now go to the Share Definitions section. So we first see the Directory Sharing Options
[techbrown] -> Share name which will be displayed.
comment = Access files stores -> Comment displayed in Network.
path = /techbrown -> Path of directory associated with the share.
host allow = address -> Specify which domain can access this share ( Also you can make entry of it in global section).
host deny= address -> Specify which domain can’t access this share.
valid users = username -> Name of users who can access the share.
public = No/Yes -> Specify whether guest user can access this share or not.
writable = No/yes -> Specify whether the shared directory is writable or not.
browseable = No/Yes -> specify whether the shared directory should be visible or not.
So let’s start with our configuration.

path = /techbrown
host allow =
host deny =
browseable = yes
writable = yes
valid users = techbrown

Save this using :wq
Now it’s time to start your service.

[root@techbrown ~]# service smb start
Starting SMB services:                                     [  OK  ]
[root@techbrown ~]# chkconfig smb on

I already have user having username techbrown. If you want to add user follow these steps.

Advertisement. Scroll to continue reading.
[root@techbrown ~]# useradd techbrown

Now it’s time to provide a password to the user.

[root@techbrown ~]# smbpasswd   -a  techbrown
New SMB password : ****
Retype new SMB password : ****

Added user techbrown.

[root@techbrown ~]#

But because of SELINUX policy client will not get access from server. SELINUX is the complex security features of Linux. It will happen if your SELINUX configured as “enforcing” in targeted mode.
Let’s talk about some Booleans
samba_export_all_ro -> Enable read only access to any directory.
samba_export_all_rw -> Enable read write access to any directory.
samba_enable_home_dirs -> Enable the sharing of a home directory.
samba_share_t Directory name-> Enables which samba can share.
So we have to enable this policy. For this just do one thing.

[root@techbrown ~]# ls -ldZ /techbrown
drwxr-xr-x. root root unconfined_u:object_r:default_t:s0 /techbrown

So to enable SELINUX environment run chcon command to change the context.

Advertisement. Scroll to continue reading.
[root@techbrown ~]# chcon -R -t samba_share_t /techbrown
[root@techbrown ~]# ls -ldZ /techbrown
drwxr-xr-x. root root unconfined_u:object_r:samba_share_t:s0 /techbrown
[root@techbrown ~]#

Now we are ready to use this share on Client side. To do this, you have to install samba-client package for Linux client. After that do following
“smbclient” command is use to connect with your share.
smbclient //ipaddr/sharename -U username

[root@techbrown ~]#  smbclient     //  -U   techbrown
Enter techbrown's password: ****
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.4-68.el6]
smb: \>

Check On windows client side

Right click on “My Computer” click on “properties”.
Click on change setting
Change workgropname with your Workgroupname.
Start —-> Run.
It will ask you username and password, type it and access the file.
Congratulation now you have configured samba server.


You May Also Like


How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...


Internet is the most important public network for connecting to the WEB. For internet connection requirement the ISP is required as well as it...


How to download and install the Mobile Intel 4 Series Express Chipset Graphics Drivers for Windows 10.  Windows 10 is the one of the...


How to Install and Configure PCSX2 on Windows 10. The Windows 10 is the most recommended operating system for the Games. In stream platform...