Install SAMBA on Fedora17 and Centos 6.2

by
Share this Article: Facebook0Google+0Twitter20LinkedIn0Reddit0StumbleUpon0

Question : Howto Install  SAMBA  on  Fedora17  and Centos 6.x?

Answer:

1- To install the samba package,enter the following command:

yum install samba samba-client samba-common

2- Configure the samba service, so that, it will start automatically at boot time:

- Centos 6.2

chkconfig smb on
chkconfig nmb on
service smb start
service nmb start

- Fedora 17

systemctl enable smb.service
 systemctl enable nmb.service
 systemctl start smb.service
 systemctl start nmb.service

3- Disable the SELinux:

nano /etc/selinux/config

Change SELinux from enforcing to disabled:

SELINUX=disabled

- Add these Iptables rules, so that samba will work perfectly:

iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
 iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
 iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
 service iptables save

4- Now edit samba config file

nano /etc/samba/smb.conf

Add these lines, in your smb.conf file (or change it according to your requirement):

#======================= Global Settings =====================================
 [global]
 workgroup = WORKGROUP
 security = share
 map to guest = bad user
 #============================ Share Definitions ==============================
 [MyShare]
 path = /samba/share
 browsable =yes
 writable = yes
 guest ok = yes
 read only = no

Save the smb.conf file and restart the service:

service smb restart
 service nmb restart

Change it, in such a way that everyone can read and write it(Check if it is allowed in your environment or not):

chmod -R 0777 /samba/share

4- Add and manage users and groups

Add a group in your CentOS server (in my case smbgrp):

groupadd smbgrp

Create a new share, set the permission on the share:

 cd /samba/
 mkdir secure
 chown -R unixmentest:smbgrp secure/
 ls -l
 chmod -R 0770 secure/
 ls -l

Add the user to the samba group and create samba password:

usermod -a -G smbgrp unixmentest
 smbpasswd -a unixmentest

Edit the smb.conf file:

nano /etc/samba/smb.conf

Add the newly created samba share in smb.conf file:

[Secure]
 path = /samba/secure
 valid users = @smbgrp
 guest ok = no
 writable = yes
 browsable = yes

Restart the samba service:
- For Centos

service smb restart
service nmb restart

For Fedora

systemctl restart smb.service
systemctl restart nmb.service

Enjoy

For questions please refer to our Q/A forum at : http://ask.unixmen.com/

Share this Article: Facebook0Google+0Twitter20LinkedIn0Reddit0StumbleUpon0