Samba server is an open source package very helpful to connect and access windows based files and printer shares. Samba implementation of the
Server Message Block (SMB) protocol.

This post describe to install samba server in linux system,

Download and Install  RPM Package:

Download the epel package and install.

# wget

# rpm -Uvh epel-release-7-5.noarch.rpm

Install Samba:

Now, install samba package enter the following command,
# yum -y install samba samba-client samba-common

Location and Version:

To find out package installed location and version,
# whereis samba

samba: /usr/lib64/samba /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz
# smbd --version
Version 4.1.1


Once the package has been installed in your system configure Samba, edit the file /etc/smb.conf.

Assume that, 

Directory      : /samba/winshare
Workgroup   : WORKGROUP
Share Name: windows

Create a directory /samba/winshare and a sample file,
# mkdir -p /samba/winshare

# chmod -R 0755 /samba/winshare

# chown -R nobody:nobody  /samba/winshare

# touch windows_share.txt

Before editing that smb.conf  file take a backup,
#  cp /etc/samba/smb.conf  /etc/samba/smb.conf_bak

#  vim /etc/samba/smb.conf

 workgroup = WORKGROUP
server string = Samba Server Version %v
netbios name = MYSERVER

### Configure samba for accessing Windows System ###
comment = Files share to Windows
path = /samba/winshare
browsable =yes
writable = yes
guest ok = yes
read only = no
create mask = 0755

Once the configuration is completed Save and check with testparm command, testparm command is helpful to  check an smb.conf file for internal correctness 
#  testparm

Restart your samba server,
# systemctl enable nmb.service

# systemctl enable smb.service

# systemctl restart nmb.service

# systemctl restart smb.service

Samba User:

Create a user and set password,
# useradd linuxfaq

# smbpasswd -a linuxfaq

New SMB password:
Retype new SMB password:
Added user linuxfaq.

Give Permission:

we need to allow the selinux for the samba configuration as follows:
# chcon -t samba_share_t /samba/winshare

Restart your samba server again,

Connect Windows System

Now, you can access Samba sharing files to your windows system. Open RUN command prompt  Windows key + R type the following command, For example your Linux system IP address is



Secured samba server

Can set proper permission for specific users and groups access files or directories, The group name centos and user fedora 

group name : centos
user name : fedora

# groupadd centos

# useradd fedora

Assign a user fedora to centos group
# mkdir /ubuntu -p

# chown -R ubuntu:centos /ubuntu/

# chmod -R 0770  /ubuntu/

In smb.conf

comment = Files shares for centosuses
path =  /ubuntu
valid users = @centos
browsable =yes
writable = yes
guest ok = yes
read only = no
create mask = 0755
hosts allow =

Finally restart your Samba server,
 # systemctl restart nmb.service

# systemctl restart smb.service

Also can check on your terminal in Linux system,
# smbclient //  -U ubuntu

Enter samba's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.1]
smb: \> ls