Google Plus

Install SAMBA on Fedora17 and Centos 6.2

Written by Mel Kham on . Posted in CentOS, Fedora, Frequently Asked Questions, Ubuntu

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

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

SK

|

I am working on it. Stay tuned. Thanks for the comment.

adriana rizzati

|

You are right, I saw them just now and they are awesome!

SK

|

Thanks for the comment Abdullah. Stay tuned with us always.

Abdullah Musazai

|

Thank you for such a great service you always do, hope you gain more power and more energy to work more & more

Dominik Bauer

|

thx a lot!

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .