How to Install and Configure Samba on CentOS 7

In this tutorial you will see how to install Samba file sharing between your CentOS 7 and Windows system. In this post I have showed about secure file sharing, here we have created admin user to access secure file sharing which will be access only from admin credential. Lets see how to install and configure Samba on CentOS 7.

Steps to install Samba

1. Very first step is to install Samba using this command

# yum install samba samba-client samba-common


2. Enable Samba Service by adding into Firewall with the following command

# firewall-cmd --permanent --zone=public --add-service=samba

# firewall-cmd --reload


3. Create Samba group and Add user in this group with samba password as follow

# groupadd smbgrp

# usermod admin -aG smbgrp

# smbpasswd -a admin


4. Now, create directory which will be use for sharing files and set the directory permission and SELinux security for samba

# mkdir -p /srv/samba

# chmod -R 0770 /srv/samba

# chown -R root:smbgrp /srv/samba

# chcon -t samba_share_t /srv/samba


5. Next step to edit the config file with samba settings. Make copy of smb.conf file before making any changes

# cp /etc/samba/smb.conf /etc/samba/smb.conf.old1

# vi /etc/samba/smb.conf

Add the following in config file ( Replace Directory and User name with Yours )

           comment = samba share
           path = /srv/samba
           valid users = @smbgrp
           guest ok = no
           writable = yes
           browsable = yes


6. Run the following command to check samba configuration

# testparm


7. Restart samba services and enable on boot

# systemctl restart smb.service

# systemctl restart nmb.service

# systemctl enable smb.service


8. Final step is to test Samba with Windows Machine

My Samba Server  :  \\\

Once you enter right credentials you will see the following file sharing windows where you can place the data

Video Tutorial


In this post, I have showed you how to enable secure file sharing between CentOS 7 and Windows by installing and configuring Samba4. Share any thoughts with us via comment section below

6 thoughts on “How to Install and Configure Samba on CentOS 7

  1. Way cool! Some extremely valid points! I appreciate you penning this post and the rest of the website is very good. Morganne Hermie Baudelaire

  2. It is in reality a great and helpful piece of info.
    I am satisfied that you simply shared this useful info with us.
    Please keep us up to date like this. Thank you for sharing.

  3. I’m really loving the theme/design of your weblog. Do you ever run into any web browser compatibility problems?
    A number of my blog audience have complained about my site not operating correctly in Explorer but looks great in Safari.
    Do you have any suggestions to help fix this problem?

Leave a Reply

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