Rabu, 04 Oktober 2017

Installing Samba File Sharing On Linux


Install samba

Install paket samba dan samba client

[root@localhost /]# rpm -ivh samba-3.5.4-68.el6.x86_64.rpm

warning: samba-3.5.4-68.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ########################################### [100%]

1:samba ########################################### [100%]

[root@localhost /]#

[root@localhost /]# rpm -ivh samba-client-3.5.4-68.el6.x86_64.rpm

warning: samba-client-3.5.4-68.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ########################################### [100%]

package samba-client-0:3.5.4-68.el6.x86_64 is already installed

[root@localhost /]#

SAMBA uses ports 137,138,139 and 445

Port 137


UDP NetBIOS name service (WINS)

Port 138


UDP NetBIOS datagram

Port 139


TCP NetBIOS Session (TCP), Windows File and Printer Sharing

Port 445


Microsoft-DS Active Directory, Windows shares (TCP)

Port 445


Microsoft-DS SMB file sharing (UDP)

To open firewall for Samba adds the following rules and restart the iptables

#iptables -A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT

#iptables -A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT

#iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT

#iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT


[root@localhost /]# iptables -A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT

[root@localhost /]# iptables -A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT

[root@localhost /]# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT

[root@localhost /]# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

[root@localhost /]#


Add user and password samba

[root@localhost /]# cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd

[root@localhost /]# chmod 600 /etc/samba/smbpasswd

[root@localhost /]# smbpasswd -a lutfi

New SMB password:

Retype new SMB password:

Added user lutfi.

[root@localhost /]#nano /etc/selinux/config

Enabled

Ctrl+x

Enter


Set SELinux value to disabled.

vi /etc/sysconfig/selinux


Selanjutnya silahkan akses via webmin dan kombinasikan dengan terminal via ssh


#chown sambauser /sharedata

#chmod 1700 /sharedata

#smbstatus

#testparm

#chgrp smbgroup /sharedata

#chmod 1770 /sharedata


Tidak ada komentar:

Posting Komentar