我对上面的链接有一个后续问题。
我在 FreeBSD 上运行 Samba 3.0.23d 版本 7.1
我按照上述方法更改了策略,但仍然无法使用 Windows 7 或 Server 2008 连接到 Samba 服务器。我觉得这是识别网络上的新机器的问题。Windows 机器可以看到 Samba 服务器,但无法连接到它或查看任何文件。更改安全策略后,Samba 服务器要求输入网络 ID 和密码,但不允许机器连接,说它们是未知用户名或密码错误。
这是我当前的配置文件。任何地方都没有任何加密的迹象,我应该添加这一行吗?不确定这在其他地方会有什么作用。
Workgroup = WWOFFSET
server string = WWO File Server (%v)
security = server
username map = /usr/local/etc/smb.users
hosts allow = 10. 127.
# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
; load printers = yes
# you may wish to override the location of the printcap file
; printcap name = /etc/printcap
# on SystemV system setting printcap name to lpstat should allow
# you to automatically obtain a printer list from the SystemV spool
# system
; printcap name = lpstat
# It should not be necessary to specify the print system type unless
# it is non-standard. Currently supported print systems include:
# bsd, cups, sysv, plp, lprng, aix, hpux, qnx
; printing = cups
# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
; guest account = pcguest
# this tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m
# Put a capping on the size of the log files (in Kb).
max log size = 50
# Use password server option only with security = server
# The argument list may include:
# password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
# or to auto-locate the domain controller/s
# password server = *
; password server = <NT-Server-Name>
password server = SERVER0
# Use the realm option only with security = ads
# Specifies the Active Directory realm the host is part of
; realm = MY_REALM
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.
; passdb backend = tdbsam
; passdb backend = smbpasswd
# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting.
# Note: Consider carefully the location in the configuration file of
# this line. The included file is read at that point.
; include = /usr/local/etc/smb.conf.%m
# Most people will find that this option gives better performance.
# See the chapter 'Samba performance issues' in the Samba HOWTO Collection
# and the manual pages for details.
# You may want to add the following on a Linux system:
# SO_RCVBUF=8192 SO_SNDBUF=8192
socket options = TCP_NODELAY
# Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them
# here. See the man page for details.
; interfaces = 192.168.12.2/24 192.168.13.2/24
# Browser Control Options:
# set local master to no if you don't want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
; local master = no
# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
; os level = 33
# Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don't use this
# if you already have a Windows NT domain controller doing this job
; domain master = yes
# Preferred Master causes Samba to force a local browser election on startup
# and gives it a slightly higher chance of winning the election
; preferred master = yes
# Enable this if you want Samba to be a domain logon server for
# Windows95 workstations.
; domain logons = yes
# if you enable domain logons then you may want a per-machine or
# per user logon script
# run a specific logon batch file per workstation (machine)
; logon script = %m.bat
# run a specific logon batch file per username
; logon script = %U.bat
# Where to store roving profiles (only for Win95 and WinNT)
# %L substitutes for this servers netbios name, %U is username
# You must uncomment the [Profiles] share below
; logon path = \\%L\Profiles\%U
# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
; wins support = yes
# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z
# WINS Proxy - Tells Samba to answer name resolution queries on
# behalf of a non WINS capable client, for this to work there must be
# at least one WINS Server on the network. The default is NO.
; wins proxy = yes
# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups. The default is NO.
dns proxy = no
# charset settings
; display charset = ASCII
; unix charset = ASCII
; dos charset = ASCII
# These scripts are used on a domain controller or stand-alone
# machine to add or delete corresponding unix accounts
; add user script = /usr/sbin/useradd %u
; add group script = /usr/sbin/groupadd %g
; add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u
; delete user script = /usr/sbin/userdel %u
; delete user from group script = /usr/sbin/deluser %u %g
; delete group script = /usr/sbin/groupdel %g
unix extensions = no
答案1
有时,Samba 会有一些缺陷,具体取决于平台。它(Samba)并不总是设置为使用加密密码。如果您导航到 /etc/smb.conf,它应该会提到一个暗示加密密码的配置项。将设置更改为与当前设置相反的值,然后发出命令:
/etc/rc.d/samba restart
<- 需要 root 权限。要么在前面加上 sudo,要么直接输入 su。
或者
/etc/rc.d/smbd restart
<- 需要 root 权限。要么在前面加上 sudo,要么直接输入 su。
重新启动 Samba 所需的命令取决于版本。几年前我遇到过这个问题,它困扰了我很长时间。还有一个开源项目叫做网页管理这对于远程或通过 Web 浏览器本地管理 *nix 机器非常有用。如果您决定使用 Webmin,请确保机器得到良好的保护。
以下是我的网络(Windows、Mac OS X、Linux、BSD)中 smb.conf 的示例,它们都在互相通信。下面的文件是从 Mac 上获取的。
; Configuration file for the Samba software suite.
; ============================================================================
;
; For the format of this file and comprehensive descriptions of all the
; configuration option, please refer to the man page for smb.conf(5).
;
; The following configuration should suit most systems for basic usage and
; initial testing. It gives all clients access to their home directories and
; allows access to all printers specified in /etc/printcap.
; BEGIN required configuration
; Parameters inside the required configuration block should not be altered.
; They may be changed at any time by upgrades or other automated processes.
;
; Site-specific customizations will only be preserved if they are done
; outside this block. If you choose to make customizations, it is your
; own responsibility to verify that they work correctly with the supported
; configuration tools.
[global]
debug pid = yes
log level = 1
server string = Mac OS X
printcap name = cups
printing = cups
**encrypt passwords = yes**
use spnego = yes
passdb backend = odsam
idmap domains = default
idmap config default: default = yes
idmap config default: backend = odsam
idmap alloc backend = odsam
idmap negative cache time = 5
map to guest = Bad User
guest account = nobody
unix charset = UTF-8
display charset = UTF-8
dos charset = 437
vfs objects = notify_kqueue,darwinacl,darwin_streams
; Don't become a master browser unless absolutely necessary.
os level = 2
domain master = no
; For performance reasons, set the transmit buffer size
; to the maximum and enable sendfile support.
max xmit = 131072
use sendfile = yes
mangled names = no
stat cache = no
wide links = no
; The darwin_streams module gives us named streams support.
stream support = yes
ea support = yes
; Enable locking coherency with AFP.
darwin_streams:brlm = yes
; Core files are invariably disabled system-wide, but attempting to
; dump core will trigger a crash report, so we still want to try.
enable core files = yes
; Filter inaccessible shares from the browse list.
com.apple:filter shares by access = yes
; Check in with PAM to enforce SACL access policy.
obey pam restrictions = yes
; Make sure that we resolve unqualified names as NetBIOS before DNS.
name resolve order = lmhosts wins bcast host
; Pull in system-wide preference settings. These are managed
; by smb-sync-preferences.
include = /var/db/smb.conf
; Pull in system share configuration. These are managed
; by smb-sync-shares.
include = /var/db/samba/smb.shares
[printers]
comment = All Printers
path = /tmp
printable = yes
guest ok = no
create mode = 0700
writeable = no
browseable = no
; Site-specific parameters can be added below this comment.
; END required configuration.
答案2
我了解到 SAMBA 有时会时好时坏。我已在 ubuntu 服务器上配置了它,但我发现通过 Windows 7 机器连接到它总是很困难。
您可以首先查看 Samba 的日志文件,看看当您尝试从 Windows 机器输入用户名/密码时究竟发生了什么。
答案3
根据 Windows 连接的 SMB 协议版本,您可能希望client use spnego = no
在 smb.conf 中切换选项(如果没有则添加它)。