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 )
[samba]
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 : \\192.168.10.202\
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 comments