Friday, February 27, 2009

Basic Samba Configuration step by step

We are trying to share knowledge about a samba by example.

we are going to create a directory path /home/data/sales.set the ownership and permission on the drectory such that people in the sales group can add/delete file but other can not.
first create a directory & set group & permission.
$ mkdir -p /home/data/sales
$ chgrp sales /home/data/sales
$ chmod 770 /home/data/sales
$ chmod g+s /home/data/sales note-: we have set special permission for group can add/delete file other can not.

# yum install samba*

open smb.conf file & add some line.

comment = sales 's file
path = /home/data/sales
public = no
write list = @sales
: writable = yes

save & exit file.
$ /etc/init.d/smb restart

make a samba users & set smbpasswd-
$ smbpasswd -a user1

Selinux- if your selinux is inforce mode then you will need to allow selinux policy
$ getsebool -a | grep sam
$ setsebool -P samba_enable_home_dirs on

Iptables- if your pc firewall is enable then you will need set rules for allow.
$ iptables -I INPUT -s -p tcp --dport 137:139 -J ACCEPT
$ iptables -I INPUT -s -p tcp --dport 445 -J ACCEPT
$ iptables -I INPUT -s -p udp --dport 137:139 -J ACCEPT
$ iptables -I INPUT -s -p udp --dport 445 -J ACCEPT
$ /etc/init.d/iptables save
$ /etc/init.d/iptables restart
$ /etc/init.d/smb restart

Client side-
$ smbclient //servername/sales -U user1

if you want to permantly mount when system boot. you should be make fstab entry
add some line in fstab file.

$ vim /etc/fstab
// /mnt cifs username=user1,passwd=matix 0 0
save this file
$ umount -a
$ mount -a
$ df -kh (for check mount enrty)

1 comment:

Anonymous said...


this is really helpful

Suresh Kalal