分类: BSD
2007-07-11 00:51:46
The following steps can be used to install on .
These steps seem to work on OpenBSD . Click one of the following
links for instructions covering prior releases:
The needs to be installed. See the for directions on how to install the ports collection.
Click one of the following links for copies of the samba config file
:
,
.
Untar the port in /usr/ports/net/samba:
# cd /usr/ports/net/samba
# ftp
# tar -xvzf port-obsd37_net_samba_3.0.14a.tgz
Build samba:
# cd 3.0.14a
# make install
Add the following to /etc/rc.local in order to have Samba automatically started during boot:
if [ -f /etc/samba/smb.conf -a X"${samba}" != X"NO" ]; thenThis can be added around line 19 in /etc/rc.local.
if [ X"${smbd_flags}" != X"NO" -a -x /usr/local/libexec/smbd ]; then
echo -n ' smbd'; /usr/local/libexec/smbd ${smbd_flags}
fi
if [ X"${nmbd_flags}" != X"NO" -a -x /usr/local/libexec/nmbd ]; then
echo -n ' nmbd'; /usr/local/libexec/nmbd ${nmbd_flags}
fi
fi
Enable Samba:
# echo 'smbd_flags="-D"' >> /etc/rc.conf.localTo run Samba without NetBIOS name resolution (nmbd), set
# echo 'nmbd_flags="-D"' >> /etc/rc.conf.local
nmbd_flags=NO
instead.
Customize /etc/samba/smb.conf:
Set the workgroup by change the following:
workgroup = MYGROUPto
workgroup = workgroup
This is around line 26.
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 29.
Enable password encryption for the [global] share by adding the following:
# Enable password encryptionThis can be added around line 36.
encrypt passwords = yes
(Optional) Prevent access to certain files:
# Prevent access to restricted filesThis can be added around line 40.
hide unreadable = yes
browseable = no
veto files = /*.exe/*.dll/*.pif/*.com/*.vbs/*.{*}
hide files = /example.txt/*.ico/
(Optional) Disable lm announce:
# Disable lm announceThis can be added around line 46.
lm announce = no
lanman auth = no
min protocol = NT1
(Optional) Disable printer loading by changing the following:
load printers = yesto
load printers = noThis is around line 45 in the default version of smb.conf and line 64 if you have made all of the previous changes.
(Optional) Put logs in a /var/log/samba:
log file = /var/log/smbd.%mto
log file = /var/log/samba/smbd.%m
This is around line 66 in the default version of smb.conf and line 88 if you have made all of the previous changes.
# mkdir -p /var/log/samba
(Optional) Disable the [printers] share by changing the following:
[printers]to
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
;[printers]This starts around line 192 in the default version of smb.conf and line 230 if you have made all of the previous changes.
; 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
(Optional) Act as a time server:
# Act as a time serverThis can be added around line 60.
time server = yes
(Optional) On systems with multiple interfaces, restrict access to samba:
hosts allow = networks
hosts deny = ALL
bind interfaces only = yes
interfaces = interfaces
To connect via the loopback interface networks
needs to contain 127.
and interfaces
needs to contains lo0
.
Valiate smb.conf:
# /usr/local/bin/testparm -s
Save the default smbpasswd and secrets.tdb:
# cd /etc/samba
# mv secrets.tdb secrets.tdb.default
# mv smbpasswd smbpasswd.default
Set the samba password for users who need samba access:
# /usr/local/bin/pdbedit -a username
Reboot or start smbd and/or nmbd manually:
# /usr/local/libexec/smbd -D
# /usr/local/libexec/nmbd -D
(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/libexec/smbd -D
root 911 0.0 0.4 3488 2048 ?? Ss 11:29PM 0:00.00 /usr/local/libexec/nmbd -D
(Optional) Test samba using smbclient:
$ /usr/local/bin/smbclient -U username \\\\localhost\\usernameor
$ /usr/local/bin/smbclient -U username //localhost/username