Friday 11 October 2013

SAMBA Server in with SAMBA GUI Console (SWAT)

SAMBA Server

yum install -y samba samba-commons cups-libs

mkdir /opt/Creative-Print                    (Here Creative-Print is a Directory to be shared)

groupadd creative-print                       (Here creative-print is Group, u can add your ex- IT, accounts)

chgrp -R creative-print   /opt/Creative-Print

chmod -R 777   /opt/Creative-Print

useradd User-1

usermod -G creative-print User-1


smbpasswd -a User-1


cd /etc/samba/
cp -p smb.conf smb.conf.orig (Copy Original smb.conf file as backup)



vi /etc/samba/smb.conf (Edit & Clear smb.conf & add only following container)


interfaces = lo eth0 eth1 172.16.16.0/24                 (Server Interface IP)
hosts allow = 127. 172.16.16.                         (IP range allow to be connect)

passdb backend = smbpasswd:/etc/samba/smbpasswd.db (Password Database File)
workgroup = MYGROUP                                         (Workgroup should same on all machine)



    [Creative-Print]
    comment = shared-directory
    path = /opt/Creative-Print
    public = no
    valid users = User-1, @creative-print
    writable = yes
    browseable = yes
    create mask = 0765



vi /etc/sysconfig/iptables (Add Following Rules in IP-Tables)

-A INPUT -s 172.16.16.0/24 -m state --state NEW -p tcp --dport 137 -j ACCEPT
-A INPUT -s 172.16.16.0/24 -m state --state NEW -p tcp --dport 138 -j ACCEPT
-A INPUT -s 172.16.16.0/24 -m state --state NEW -p tcp --dport 139 -j ACCEPT
-A INPUT -s 172.16.16.0/24 -m state --state NEW -p tcp --dport 445 -j ACCEPT


Restart & Save Iptable config

/etc/init.d/iptables restart
/etc/init.d/iptables save


Restart SAMBA Services

/etc/init.d/smb start
/etc/init.d/nmb start




Open the Run and type \\ip-address-of-samba-server\shared-Directory-name
 for eg. \\172.16.16.247\Creative-Print

Give username and password. (password which you set with the help of smbpasswd command)







********************************************************************************

Installation of SAMBA GUI Console (SWAT)


yum -y install xinetd samba-swat (Install GUI Package & xientd Service)

vi /etc/xinetd.d/swat (Edit the swat config file & add the following Component)

# On line 10: IP address you allow
only_from = 127.0.0.1 10.0.0.0/24

# On line 14: change
disable = no



/etc/rc.d/init.d/xinetd start (Restart the XenetD Service)
chkconfig xinetd on



Allow in 901 port in firewall I.E Iptable

vi /etc/sysconfig/iptables (Add Following Rules in IP-Tables)

-A INPUT -s 172.16.16.0/24 -m state --state NEW -p tcp --dport 901 -j ACCEPT



/etc/init.d/iptables restart
/etc/init.d/iptables save

Access Via Browser 

http://172.16.16.247:901 OR  http://samba-server-ip:901



********************************************************************************

No comments:

Post a Comment