Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail
Install the Samba:
[[email protected] ~]#yum -y install samba samba-client


Create a folder for samba share

[[email protected] ~]#mkdir /home/share

Then give it the appropriate permission:
[[email protected] ~]#chmod 777 /home/share

Configure the service
[[email protected] ~]#vi /etc/samba/smb.conf
  near line 66: add

unix charset = UTF-8

  line 90: change (Windows' default)

workgroup = WORKGROUP


  line 98: uncomment

max protocol = SMB2


  line 96: uncomment and change to the IPs you permit to access

hosts allow = 127. 10.0.0.


  line 126: add ( no auth )

security = user
 passdb backend = tdbsam

map to guest = Bad User
  add to the last line


  any name you like
 path = /home/share
shared directory

writable = yes

   guest ok = yes

 guest only = yes

look all as guests
create mode = 0777

fully accessed
directory mode = 0777

fully accessed
share modes = yes
warn if some people access to a file
start the smb service

[[email protected] ~] systemctl start smb.service

[[email protected] ~] systemctl start nmb.service

[[email protected] ~] systemctl enable smb.service

[[email protected] ~] systemctl enable nmb.service


Set firewall

Further CentOS 7.0 Firewall-cmd will block the samba access, to get rid of that we will run:

[[email protected] ~]  firewall-cmd --permanent --zone=public --add-service=samba
[[email protected] ~]  firewall-cmd --reload
Set Selinux

Turn the samba_domain_controller Boolean on to allow a Samba PDC to use the useradd and groupadd family of binaries. Run the following command as the  root user to turn this Boolean on:
setsebool -P samba_domain_controller on

Turn the samba_enable_home_dirs Boolean on if you want to share home  directories via Samba. Run the following command as the root user to turn this  Boolean on:
setsebool -P samba_enable_home_dirs on

If you create a new directory, such as a new top-level directory, label it with samba_share_t so that SELinux allows Samba to read and write to it. Do not label system directories, such as /etc/ and /home/, with samba_share_t, as such directories should already have an SELinux label.

Run the “ls -ldZ /path/to/directory” command to view the current SELinux  label for a given directory.

Set SELinux labels only on files and directories you have created. Use the
chcon command to temporarily change a label:
chcon -t samba_share_t /path/to/directory

To share such directories and allow read only permissions:

setsebool -P samba_export_all_ro on
To share such directories and allow read and write permissions:
setsebool -P samba_export_all_rw on