Thursday, September 15, 2011

How to install Samba CentOS

Install samba
# yum install samba

Configure samba
# vi /etc/samba/smb.conf
[global]
workgroup = Linux
netbios name = CentOS_Srv
;name resolve order = bcast host lmhosts wins
server string = CentOS Samba v.%v
security = user
passdb backend = tdbsam

[www]
comment = Public WWW
path = /var/www
create mask = 0660
directory mask = 0771
writable = yes
valid users = user1 user2

Add User for samba
# useradd user1 -d /mnt/data/home/user1
# chown user1:user1 /mnt/data/home/user1
# passwd user1
#     Enter your password
# smbpasswd -a user1


# /etc/init.d/smb restart

Configure Firewall for samba
Change IPTables
# vi /etc/sysconfig/iptables
#Includes the following before the REJECT line:
-A INPUT -p udp -m udp --dport 137 -j ACCEPT
-A INPUT -p udp -m udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

# service iptables restart


Run samba when OS starting
# chkconfig --levels 235 smb on


Client test
net use  Z: \\192.168.6.2\www /user:user1


http://wiki.centos.org/HowTos/SetUpSamba