Samba is a free software re-implementation of the SMB/CIFS networking protocol, provides file and print services for various Microsoft Windows clients and can integrate with a Windows Server domain. In the end of this tutorial you will be able to install and configure samba to work in Microsoft workgroup environment.
A computer with CentOS 6.3 installed on it.
Computer with any version of widows installed on it.
For the sake of the simplicity of this tutorial you need to turn off the firewall and SELinux.
Step 1 - Install the service
The below commands by the order will install the service, run it and make it run in the startup
sudo yum install samba
sudo service smb start
sudo chkconfig smb on
Step 2 - Create the sharing directory and the users
Create a folder and name it as an example samba
sudo mkdir /samba
sudo chmod 777 /samba -R
Now create the users,
sudo useradd bob
sudo useradd sally
sudo smbpasswd -a bob //and you will be prompted to type the password
sudo smbpasswd -a sally //and you will be prompted to type the password
Step 3 - Configure smb.conf
smb.conf is the configuration file for the samba program, you can configure the shares through this file. you will find this file in /etc/samba/ directory. Now open this file with any text editor, in this example I will use the nano editor
sudo nano /etc/samba/smb.conf
Copy and paste the below in the end of the file
[Samba Share] comment = Shared folder between bob and sally
path = /samba
valid users = bob,sally
admin users = bob
read list = sally
writable = yes
Now restart the samba service
sudo service smb restart
In this example we shared the /samba directory and give bob read and write permission and read only permission for sally
Step 3 - Access the shared folder from windows machine
Open run and write the IP address of the server as the below example
You will be prompted to write the user name and password, congratulation you can now access the shared folder.