SAMBA Server :- Complete Installation & Configuration
Last updated on March 12th, 2018 at 09:34 pm
Hello Linux-fanatics , in earlier tutorials about file sharing we discussed about NFS & VSFTP . Both are used to share files among Linux file-systems. Now, we will discuss SAMBA server installation & configuration.
Samba server is used to share files with Windows system. We can also share printer services with it.
Let’s now setup a scenario for testing our server
Server Client’s Machine
OS : Centos/RHEL 6 or 7 OS :Windows 10 or Centos/RHEL 6 or 7
Hostname : smbserver.test.com Hostname: windows.test.com
IP Address :192.168.1.100 IP Address : 192.168.1.101
(Recommended Read: Integrating Active Directory with Linux (RHEL / CentOS))
Samba Server Installation
We need to install following packages to install Samba on our server
If we are using a Windows machine as client, we don’t need any special packages installed on windows machine but if using Centos/RHEL for testing, we need to install following packages
Now, our installation is done. We will now configure our shared folder.
Firstly, we will create a user & a directory for share
Now, we will give all the permissions (777 read, write & execute for all users) to our /shared folder
We now have a folder to share & we will now make changes in configuration file to share the folder
and at the bottom of the file , add following lines
Now our shared folder is ready to be used but before we do that we need to assign password to our smbuser by using the following command
and enter the desired password. We can now test our shared folder.
Testing on Linux machine
Firstly, we will check if the shared folder is accessible or not. This can be done by
If folder is accessible, you will see output on screen with details of shared folder. Once it’s confirmed that folder is accessible, we will mount it on our system
where /media/samba is directory to access shared folder on our system. But this mount is a temporary mount & will be unmounted as soon as we remount all partitions or restart our system.
In order to permanently mount it our system, we need to add following line in /etc/fstab file
/media/samba/.smbaccess is a hidden file with our credentials i.e.
password= password for user
Now, our shared folder will be permanently mounted. Now, let’s test our samba share on a Windows machine.
Testing on Windows machine
On windows machine, open you “My Computer” & on top bar there should a option to map your drive (refer to screenshot below). Click on that option , then enter your drive address & credentials.
Upon successful verification of credentials, drive will show up with other local drives of your system.
Test it by creating a file. It should work fine.
Using Samba Server when Selinux is enabled
We might not be able to use our shared folder when Selinux is enabled as we need to set Boolean & security context values. We need to make changes to Selinux values by running following commands
This completes our tutorial on Samba Server installation & configuration. If facing any issue or have any queries/feedback, please use the comment box below.