Configure Samba Server on CentOS 6.X / RHEL 6.X
In most of the envoirnments Linux and windows operating system are used , and to share the files & printers between linux and windows platform Samba is used. Samba server is generally used where most of the clients are running on windows OS and Linux samba Server is serving files and printer.
Installation Steps :
Step:1 Install the Samba Package using yum
First Check whether samba package is installed or not using below command:
[root@site1 ~]# rpm -qa | grep samba
[root@site1 ~]# yum list installed | grep samba
If Samba server is not installed , then use below command to install.
[root@site1 ~]# yum install samba -y
Step:2 Create a folder to be shared by Samba Server.
In my sceanrio i have created a folder /mnt/smb-share ,
[root@site1 ~]# mkdir /mnt/smb-share
[root@site1 ~]# chmod 777 /mnt/smb-share/
Step:3 Now create a user , which will be allowed to access the share.
Create a user using useradd command and then assgin password using smbpasswd command , this user will be allowed to access the share from the clients like Windows & Linux.
[root@site1 ~]# useradd nextstep
[root@site1 ~]# smbpasswd -a nextstep
New SMB password:
Retype new SMB password:
Added user nextstep.
Step:4 Edit the Samba Server Configuration file (/etc/samba/smb.conf)
Add the below lines at the end of file
comment = Samba Share
path = /mnt/smb-share/
writable = yes
valid users = nextstep
We can also Change the default workgroup and controll the access of samba share on the basis ip by editing the config file as shown below.
workgroup = MYGROUP
hosts allow = 127. 192.168.1. 192.168.2.
Save the change and quit the file
Step:5 Now Start the Samba Service & enable the service after reboot.
[root@site1 ~]# /etc/init.d/smb start
Starting SMB services: [ OK ]
[root@site1 ~]# chkconfig smb on