Wednesday, December 11, 2013

RHCE Preparation / How to configure a Samba Server

   1.  Install samba software


#yum install samba -y 


 2. Configure the service to start when the system is booted

#chkconfig smb on

#chkconfig nmb on

   3.  Edit the smb.conf Configuration File

Edit Samba configuration file

#vi /etc/samba/smb.conf

workgroup = SAMBGRP
[common]

comment = "Share here"
path = /common
valid users = john
browseable = yes
hosts deny = 192.168.1.0 


     4. Add Samba Users

#smbpasswd -a john

    5. Configure iptables


#iptables -I INPUT  -p udp --dport 137 -j ACCEPT

#iptables -I INPUT  -p udp --dport 138 -j ACCEPT

#iptables -I INPUT  -p tcp --dport 139 -j ACCEPT 

#iptables -I INPUT  -p tcp --dport 445 -j ACCEPT 


    6. Configuring SELinux
Once the configuration file is set you won’t be able to share the directory unless “SELinux” is configured properly.  SELinux adds an extra later of security to Linux to help protect your system.  There are a few ways of doing this.

     A.  To change directory type for sharing SAMBA

#mkdir /common

#chcon -t samba_share_t /common

     B.  Share with read only

 #setsebool -P samba_export_all_ro on


    7. Restart Services

#service smb restart

#service nmb restart


    8. Enter with "user" client to our share 

#smbclient //ip_address/common

No comments:

Post a Comment