Monday, January 23, 2012

Install Samba on FreeBSD 8.2

Install Samba on FreeBSD 8.2

root@bmw0 [/root] # cd /usr/ports/net/samba36; make install clean

Edit smb.conf

root@bmw0 [/root] # vi /usr/local/etc/smb.conf
security = user
hosts allow = 192.168.100. 192.168.200.168 127.
load printers = no

[syncdb]
comment = hmm
path = /usr/local/www/apache22/data/syncdb
valid users = smb_user0
public = no
writable = yes
printable = no
create mask = 0600
directory mask = 0700
; write list = @staff

Add a user called "smb_user0"
root@bmw0 [/root] # pw useradd -n smb_user0 -s /sbin/nologin -w no -d /home/smb_user0 -c "Samaba User0" -m

Adding users to samba
root@bmw0 [/root] # /usr/local/bin/pdbedit -a smb_user0
or
root@bmw0 [/root] # smbpasswd -a smb_user0

List user
root@bmw0 [/root] # /usr/local/bin/pdbedit -L

Edit rc.conf
root@bmw0 [/root] # vi /etc/rc.conf
### Samba
samba_enable="YES"
#nmbd_enable="YES"
#smbd_enable="YES"
winbindd_enable="YES"

Start Samba
root@bmw0 [/root] # /usr/local/etc/rc.d/samba start
root 56804 0.2 0.7 39668 14484 ?? Ss 5:15PM 0:00.04 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
root 56807 0.2 0.7 39752 14564 ?? S 5:15PM 0:00.00 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
root 56800 0.0 0.4 29696 7464 ?? Ss 5:15PM 0:00.01 /usr/local/sbin/nmbd -D -s /usr/local/etc/smb.conf

Check to see if samba is running
root@bmw0 [/root] # ps -auwxx | egrep '[sn]mbd|winbindd'

Test samba using smbclient
root@bmw0 [/root] # /usr/local/bin/smbclient -U smb_user0 \\\\localhost\\smb_user0
or
root@bmw0 [/root] # /usr/local/bin/smbclient -U smb_user0 //localhost/smb_user0

Edit ipfw.rules
root@bmw0 [/root] # vi /usr/local/etc/ipfw.rules
### samba
$IPF 260 allow tcp from 192.168.100.0/24 to any 139 in

Reference:
http://gala4th.blogspot.com/2012/01/install-samba-on-freebsd-82.html

No comments: