How to Configure Samba Server on RHEL7

(Last Updated On: October 3, 2018)

How to configure samba server on Rhel7 or centos7


                                 If you are searching for an article like this one, then I can be pretty sure about the fact that you want a file sharing service for your network. Basically, you have a network in your office or home and with windows and Linux hosts.

Now if you want to share file between these Linux and Windows hosts, you need to configure samba server. So let me just tell you that you need to know what samba actually is and how it works before you know about how to configure samba server.


What is a samba server?


Ans:  Samba is the standard Windows interoperability suite of programs for Linux and Unix. was originally developed by Andrew Tridgell.

It is a very important component to consistently combine Linux or Unix Servers as well as desktops into Windows Active Directory environments. It can function both ways like as a domain controller or as a regular domain member.

Samba has provided a stable, secure and fast file and print services for all the clients who are using the SMB or CIFS protocol Since 1992.  It runs on most of the  Unix and Unix-like systems, such as Linux, AIX, Solaris and the BSD variants. Apple’s macOS Server and macOS client (Mac OS X 10.2 and greater) are also there to mention.


Why we use Samba?

The feature of sharing file and printer through the network of all  Linux distros is mostly based on Samba. It is an interpretation of Microsoft’s network filesystem. We use SAMBA for executing various tasks such as file sharing and printer sharing. These services can be used on computers running Microsoft Windows and computers running on Unix as well.

These are the services that are provided by Samba.

  • File & print services
  • Authentication and Authorization Services
  • Name resolution Services
  • Service announcement (browsing)



So now let’s configure Samba Server


Server Part: (Configuration)

#  yum install samba samba-client  -y  [install samba package]
#  systemctl  start smb nmb     [start samba service]
#  systemctl enable  smb nmb    [enable it so that it will be active after reboot]
#  firewall-cmd  - -permanent  - -add-service=samba   [add firewall exception rule]
#  firewall-cmd  - -reload      [reload firewall]
#  mkdir   /smbshare            [create a share directory]
#  semanage fcontext  -a -t samba_share_t  '/smbshare(/.*)?' [change the file context]
#  ls -ld  /smbshare             [verify it]
#  restorecon  -RFv  /smbshare   [Restore SELinux Context]

#  vim /etc/samba/smb.conf                       [edit the configuration file]

line no.89    workgroup = workgroup        [set workgroup]
line no.95    hosts allow = 127.  10.100.  [it will be your network segment ending up with a "."]
line no.322   [samba]                      [configure the sahre path]
                 path = /smbshare
                 browseable = yes
                 writable = no
                 valid users = smbuser

:wq!       [save it]

#  systemctl  restart smb nmb        [restart samba service]
#  useradd   smbuser                 [add samba user]
#  smbpasswd  -a   smbuser           [provide samba password]

enter password
confirm password
#  testparm                           [check if the share is available]
#  chown  smbuser   /smbshare         [change ownership]
#  chmod  770  /smbshare              [change permission]

Client part: ( Login)


samba server


Linux system

#  smbclient -U  smbuser  -L  \\servername  or IP 

enter smb-user password

Windows system

win key + R  ( it will open run)

type \\servername  or IP\smbshare

it will prompt for user id and password.

hence you can access your samba share.




The above-mentioned steps are for configuring a samba server on a Linux system for sharing files over the network. But you might face some challenge if you are new to Linux or doing this type of configuration for the first time.

So for that sort of issues, I am always there to guide you guys. Feel free to ask me any question regarding Samba or other Linux related questions. I will try to reply as early as possible.




So, guys, I have tried my best to simplify things so that you can have a better understanding and user experience. Now it’s your turn to pay me back.

Now I am expecting your responses. If you like this content or even dislike,  just leave a comment. Your responses will motivate me to do better and deliver better. I will try my best to enrich my skill.

So thank you guys, Have a good day.


Rate this content
User Review
5 (3 votes)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Ad Blocker Detected

Ad Blocker Detected, please disable it to help this page in many ways. Thank you so much.