The following steps can be used to enable Samba on FreeBSD.
Notes: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 = MYGROUPto
workgroup = 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 Serverto
server string = hostnameThis is around line 24.
Enable password encryption for the [global] share by adding the following:
# Enable password encryption encrypt passwords = yesThis can be added around line 31.
(Optional) Disable printer loading by changing the following:
load printers = yesto
load printers = noThis 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 = yesto
;[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 = yesThis starts around line 192.
(Optional) If CUPS is installed and Samba printing should be enabled change the following:
; printing = bsdto
printing = cupsThis is around line 56.
(Optional) Act as a time server:
# Act as a time server time server = yesThis 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.defaultThis 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\\usernameor
$ /usr/local/bin/smbclient -U username //localhost/username
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 Serverto
server string = hostnameThis 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.%mto
log file = /var/log/samba/log.%mThis is around line 54.
Enable password encryption by changing the following:
; encrypt passwords = yesto
encrypt passwords = yesThis 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 %uThis can be added around line 69.
(Optional) Disable printer loading by changing the following:
load printers = yesto
load printers = noThis 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 = yesto
;[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 = yesThis starts around line 170.
(Optional) If CUPS is installed and Samba printing should be enabled change the following:
; printing = bsdto
printing = cupsThis 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\\usernameor
$ /usr/local/bin/smbclient //localhost/username