Enabling Samba on FreeBSD
The following steps can be used to enable Samba on FreeBSD.
Notes:- These steps seem to work on FreeBSD 5.2.1. They should work on other versions as well.
- The ports collection needs to be installed.
Steps for Samba version 3.0.3:
Install Samba from /usr/ports/net/samba-devel:
# cd /usr/ports/net/samba-devel # make install
Enable Samba:
# echo 'samba_enable="YES"' >> /etc/rc.conf.local
Customize /usr/local/etc/smb.conf:
Set the workgroup by change the following:
workgroup = MYGROUP
toworkgroup = workgroup
This is around line 21.
If a NT Domain/Workgroup doesn't exist, the workgroup can be set to the DNS domain name.Set the server string by changing the following:
server string = Samba Server
toserver string = hostname
This is around line 24.Enable password encryption for the [global] share by adding the following:
# Enable password encryption encrypt passwords = yes
This can be added around line 31.(Optional) Disable printer loading by changing the following:
load printers = yes
toload printers = no
This is around line 43.
(Optional) Disable the [printers] share by changing the following:
[printers] comment = All Printers path = /var/spool/samba browseable = no # Set public = yes to allow user 'guest account' to print guest ok = no writable = no printable = yes
to;[printers] ; comment = All Printers ; path = /var/spool/samba ; browseable = no # Set public = yes to allow user 'guest account' to print ; guest ok = no ; writable = no ; printable = yes
This starts around line 192.(Optional) If CUPS is installed and Samba printing should be enabled change the following:
; printing = bsd
toprinting = cups
This is around line 56.(Optional) Act as a time server:
# Act as a time server time server = yes
This can be added around line 41.
Valiate smb.conf:
# /usr/local/bin/testparm -s
Save the default smbpasswd and secrets.tdb:
# cd /usr/local/private # mv secrets.tdb secrets.tdb.default # mv smbpasswd smbpasswd.default
This may be required only when upgrading from older versions of samba.Set the samba password for users who need samba access:
# /usr/local/bin/pdbedit -a username
Start Samba:
# /usr/local/etc/rc.d/samba.sh start
(Optional) Check to see if samba is running:
$ ps -auwxx | egrep '[sn]mbd' root 909 0.0 0.8 6504 4008 ?? Is 11:29PM 0:00.00 /usr/local/sbin/smbd -D root 911 0.0 0.4 3488 2048 ?? Ss 11:29PM 0:00.00 /usr/local/sbin/nmbd -D
(Optional) Test samba using smbclient:
$ /usr/local/bin/smbclient -U username \\\\localhost\\username
or$ /usr/local/bin/smbclient -U username //localhost/username
Steps for Samba version 3.0.0:
Install Samba from /usr/ports:
# cd cd /usr/ports/net/samba-devel # make install
Enable Samba:
# cd /usr/local/etc/rc.d # ln -s samba.sh.sample samba.sh
Customize /usr/local/etc/smb.conf:
Set the server string by changing the following:
server string = Samba Server
toserver string = hostname
This is around line 21.Modify logging (samba creates two log files per host that connects, so a separate samba log directory is useful) by changing the following:
log file = /var/log/log.%m
tolog file = /var/log/samba/log.%m
This is around line 54.Enable password encryption by changing the following:
; encrypt passwords = yes
toencrypt passwords = yes
This is around line 67.Enable password synchronization by adding the following to the [global] share:
# Enable unix password synchronization unix password sync = yes passwd program = /usr/bin/passwd %u
This can be added around line 69.(Optional) Disable printer loading by changing the following:
load printers = yes
toload printers = no
This is around line 32.
(Optional) Disable the [printers] share by changing the following:
[printers] comment = All Printers path = /var/spool/samba browseable = no # Set public = yes to allow user 'guest account' to print guest ok = no writeable = no printable = yes
to;[printers] ; comment = All Printers ; path = /var/spool/samba ; browseable = no ;# Set public = yes to allow user 'guest account' to print ; guest ok = no ; writeable = no ; printable = yes
This starts around line 170.(Optional) If CUPS is installed and Samba printing should be enabled change the following:
; printing = bsd
toprinting = cups
This is around line 45.
Create the samba log file directory:
# mkdir -p /var/log/samba
Set the samba password for users who need samba access:
# /usr/local/bin/pdbedit -a username
Start Samba:
# /usr/local/etc/rc.d/samba.sh start
(Optional) Check to see if samba is running:
$ ps -auwxx | egrep '[sn]mbd' root 909 0.0 0.8 6504 4008 ?? Is 11:29PM 0:00.00 /usr/local/sbin/smbd -D root 911 0.0 0.4 3488 2048 ?? Ss 11:29PM 0:00.00 /usr/local/sbin/nmbd -D
(Optional) Test samba using smbclient:
$ /usr/local/bin/smbclient \\\\localhost\\username
or$ /usr/local/bin/smbclient //localhost/username

