📄 1550.html
字号:
为了使Samba伺服器支持域认证方式,可以有两种不同的设置方式,一种为真正的域认证,另一种为伺服器认证 方式,将Samba伺服器配置为通过伺服器验证用户,这需要指定security=server,以及指定password server的名字为NT的域控制器。认证伺服器的方式不能事先域认证方式提供的一些特征,但它的适用范围并 不仅限于域,使用工作组的网路也能通过统一的认证伺服器来使用统一认证模式。设置域认证方式在后面进行详细解释。<br>
在Windows NT 4及Windows 98之后,客户和伺服器之间进行认证时,密码不再以明文的方式 在网路中传输了。为了支持加密密码传输,需要设置encrypt passwords选项。同样,这也需要其他复杂的 设置。<br>
# Using the following line enables you to customise your configuration<br>
# on a per machine basis. The %m gets replaced with the netbios name<br>
# of the machine that is connecting<br>
; include = /usr/local/etc/smb.conf.%m<br>
系统管理员可以为每个特定的电脑定制一个特定的配置档案,那里的设置将覆盖smb.conf中的缺 省设置。这样就可以针对不同的电脑提供不同的配置。<br>
# Most people will find that this option gives better performance.<br>
# See speed.txt and the manual pages for details<br>
socket options = TCP_NODELAY<br>
socket参数用于配置对TCP的处理方式,以适合Microsoft客户的特征。Microsoft习惯为每个很短 的会话都建立单独的连接,而不是使用一个连接进行多次传输,这样在传输中就需要进行多次连接会话设 定过程,对性能有一定影响。为了改善性能,需要设置TCP_NODELAY或IPTOS_LOWDELAY选项。<br>
# Configure Samba to use multiple interfaces<br>
# If you have multiple network interfaces then you must list them<br>
# here. See the man page for details.<br>
; interfaces = 192.168.12.2/24 192.168.13.2/24<br>
如果电脑上有多个网路界面,那么就需要让samba向多个界面广播b-node广播包,以及为这些 界面提供资源服务,否则samba就会只向某一个界面提供网路服务。当然也可以设置这个参数,使得samba 只服务于某个指定的网路,而不是伺服器连接所有的网路。<br>
# Browser Control Options:<br>
# set local master to no if you don't want Samba to become a master<br>
# browser on your network. Otherwise the normal election rules apply<br>
; local master = no<br>
<br>
# OS Level determines the precedence of this server in master browser<br>
# elections. The default value should be reasonable<br>
; os level = 33<br>
<br>
# Domain Master specifies Samba to be the Domain Master Browser. This<br>
# allows Samba to collate browse lists between subnets. Don't use this<br>
# if you already have a Windows NT domain controller doing this job<br>
; domain master = yes<br>
<br>
# Preferred Master causes Samba to force a local browser election on startup<br>
# and gives it a slightly higher chance of winning the election<br>
; preferred master = yes<br>
# Use only if you have an NT server on your network that has been<br>
# configured at install time to be a primary domain controller.<br>
; domain controller = <NT-Domain-Controller-SMBName><br>
这些设置选项主要用于SMB网路中进行浏览时,设置samba伺服器的行为。预设情况不让samba伺服器参 加broswser的推举过程,为了使得samba伺服器能成为browser,就需要设定local master =yes。然后samba服务就可以根据os level设置的权重进行推举,预设的os level为0,这个权重 不会赢得推举。但可以取消注释,将os level设置为33,这将在与所有Windows电脑(包括Windows NT) 的推举竞赛中获得胜利,因为NT server的权重为32。设置比33更高的权重,只是在不同的samba 伺服器之间进行选择时才有意义。<br>
由于Unix及Samba伺服器在同样硬体配置下具有更高的网路性能,因此一般情况下,使用Samba伺服器 作Browser更佳。当然可能在Samba伺服器启动之前,网路中都已经存在了Browser了,一般情况下不必重 新进行推举过程,让网路中的现有Browser继续发挥作用。如果希望Samba伺服器总是成为Browser,可以 设置当Samba伺服器启动时,迫使网路中重新进行推举过程,这需要设定perfered master参数。<br>
通常Samba能够胜任master Browser的角色,然而在多个子网的情况时,网路上就会存在Local master Browser和Domain master Browser。以上的设置只能使Samba成为 Local master Browser,预设Samba并不参加Domain master Brower的推举 。设置Samba伺服器成为Domain master Browser就必须使用domain master参数进 行设置,这对于使用工作组方式进行跨子网浏览意义重大。<br>
但是如果网路使用的是NT的域方式,就要使用NT的域控制器作为Domain master Browser ,不要设置与NT域控制器同一个子网中的Samba伺服器的domain brower与browser功能,以免它 和域控制器竞争。不让Samba伺服器和NT域控制器竞争的原因是由于Windows NT中域控制器还涉及域认证( 不是认证域用户,而是认证域上的合法成员电脑),SMB协议中各种复杂功能交错混合,浏览和认证两种不同的功能竟也 混合在一起。由于域控制器完成的域认证任务,Samba伺服器不能够完成,因此为了避免与NT域控制器相互冲突,最好 使用域控制器作Domain master Browser。<br>
让Samba伺服器了解目前域中存在的域控制器的方法是指定在设置档案中指定域基本控制器PDC(primary Domain Controller)的NetBIOS名字,这需要使用domain controller参 数进行设置。<br>
# Enable this if you want Samba to be a domain logon server for<br>
# Windows95 workstations.<br>
; domain logons = yes<br>
<br>
# if you enable domain logons then you may want a per-machine or<br>
# per user logon script<br>
# run a specific logon batch file per workstation (machine)<br>
; logon script = %m.bat<br>
# run a specific logon batch file per username<br>
; logon script = %U.bat<br>
<br>
# Where to store roving profiles (only for Win95 and WinNT)<br>
# %L substitutes for this servers netbios name, %U is username<br>
# You must uncomment the [Profiles] share below<br>
; logon path = \%LProfiles\%U<br>
当用户通过一台Windows 9x客户机使用用户级认证访问网路时,他可以选择登录进网路中的域。这意味着 他不但要在SMB伺服器中进行验证,而且会执行伺服器中相应目录中的登录脚本,以自动执行一些相关设置。通常这种登录 功能是由Windows NT伺服器来执行的,然而Samba伺服器也能完成这个任务,但必须设定domain logons 参数。此后就可以对不同的客户电脑或不同用户指定相应的登录脚本。这个功能还必须要求在本配置档案后面设置 netlogon共享选项,以便客户机能访问相应的登录脚本。<br>
除了登录脚本之外,Windows NT中为了支持移动用户在不同地点进行漫游,也提供了针对每个用户的描述 其使用环境的Profile档案,Samba伺服器也可以通过logon path来支持对windows客户机这种 漫游能力的支持。这样当Windows客户机使用漫游功能的时候,客户机会自动将用户的配置档案保存到伺服器上,此后 每次登录进域的时候都重新下载这个配置档案,设置Windows桌面环境。<br>
# Windows Internet Name Serving Support Section:<br>
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server<br>
; wins support = yes<br>
# WINS Server - Tells the NMBD components of Samba to be a WINS Client<br>
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both<br>
; wins server = w.x.y.z<br>
<br>
# WINS Proxy - Tells Samba to answer name resolution queries on<br>
# behalf of a non WINS capable client, for this to work there must be<br>
# at least one WINS Server on the network. The default is NO.<br>
; wins proxy = yes<br>
<br>
# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names<br>
# via DNS nslookups. The built-in default for versions 1.9.17 is yes,<br>
# this has been changed in version 1.9.18 to no.<br>
dns proxy = no<br>
上面的这些选项是用于设置NetBIOS名字解析方式,wins support选项使得nmdb能对外表现 为一个NBNS伺服器。wins server用于指定一个外部名字伺服器的地址(可以为NT上的wins伺服器或另 一个Samba伺服器),使得nmbd能用做NBNS客户端,通过访问该wins名字伺服器解析NetBIOS名字。<br>
此外,还有一些不使用名字伺服器进行解析的NetBIOS客户,如果名字伺服器位于另一个子网上,那么它们就 无法正确解析名字,而Samba可以使用wins proxy帮助它们使用名字伺服器解析地址。例如一个WINS服务 器在另一个子网上,本地子网内的Samba伺服器配置了wins server的地址,其他Windows客户没有设 置wins伺服器地址,它们使用b-node广播方式查询名字,在这台Samba伺服器设置了wins proxy能 力之后,它就能代替wins伺服器回应客户请求。因此要用作wins代理,就必须本身能使用名字伺服器进行解析,就要 求先设置wins server参数。<br>
此外,NetBIOS名字解析也可以扩展到通过DNS查询进行帮助,使用dns proxy设置就能让Samba 伺服器通过dns进行查询,回应NetBIOS名字查询请求。<br>
* [homes]个人目录共享<br>
#============================ Share Definitions ==============================<br>
[homes]<br>
comment = Home Directories<br>
browseable = no<br>
writable = yes<br>
[homes]部分使得每个Unix用户通过SMB客户登录上来的时候,可以共享使用他自己的个人目录。这个 共享资源具备特别属性,当用户登录上之后,共享名就不是homes,而是被伺服器映射为用户自己的标识符。<br>
设置这个特别的共享选项,就允许每个用户访问自己的个人目录,而不必为每个用户都配置一个共享资源部分。正由 于系统会自动映射,因此就不需要定义要共享的档案目录路径,而在其它档案资源共享选项中,都需要使用path参数进行 定义。<br>
由于Samba系统会自动将homes共享名改变为用户的个人标识符,因此要设定browseable=no ,设置homes本身这个名字不出现在资源列表中。writable为用户写权限设置,由于是在用户的个人目录下,用 户可以具备写权限。<br>
* [netlogon]与[Profiles]<br>
# Un-comment the following and create the netlogon directory for Domain Logons<br>
; [netlogon]<br>
; comment = Network Logon Service<br>
; path = /usr/local/samba/lib/netlogon<br>
; guest ok = yes<br>
; writable = no<br>
; share modes = no<br>
当允许Samba伺服器支持客户的网路登录功能之后(设置domain logon),就需要设置
[netlogon]部分(删除注释符号),为guest用户打开登录路径的访问权限,以保证每个用
户都能访问其自己的登录脚本。由于需要使用guest对应的Unix帐户访问登录脚本,这个登
录路径及其下面的脚本档案都要允许该Unix帐号可 以读取。<br>
建立这个目录之后,要设定正确的权限,并且创建这个目录下对应各个电脑或用户的
登录脚本,以提供给客户正确的登录脚本。<br>
# Un-comment the following to provide a specific roving profile share<br>
# the default is to use the user's home directory<br>
;[Profiles]<br>
; path = /usr/local/samba/profiles<br>
; browseable = no<br>
; guest ok = yes<br>
当支持Windows电脑漫游能力时,可以设定[Profiles]部分,并为相应的路径建立目录,
及分配权限。 来为Window电脑用户设置桌面环境。<br>
* [Printers]印表机设置<br>
# NOTE: If you have a BSD-style print system there is no need to<br>
# specifically define each individual printer<br>
[printers]<br>
comment = All Printers<br>
path = /var/spool/samba<br>
browseable = no<br>
# Set public = yes to allow user 'guest account' to print<br>
guest ok = no<br>
writable = no<br>
printable = yes<br>
这个部分就用于设置将printcap中定义的所有印表机使用的相关设置,预设情况下允
许所有的合法客户使用 所有的印表机。BSD风格的打印系统,不需要任何设置就能正确共
享所有的印表机,当然也可以使用printer参数指 定具体的印表机以提供共享。而path参
数定义的是印表机缓冲区的位置。guest ok、writeable用于设 置正确的权限,而
printable用于设置打印属性。<br>
由于Windows的打印驱动已经将要打印的档案转化为印表机支持的那种描述语言,因此
这些打印档案不再需要 任何过滤器进行转换。因此需要在printcap中定义一个不使用任何
过滤器、直接将打印文档输出到印表机端口的打印 机选项。<br>
* 其他专有共享目录<br>
# This one is useful for people to share files<br>
;[tmp]<br>
; comment = Temporary file space<br>
; path = /tmp<br>
; read only = no<br>
; public = yes<br>
<br>
# A publicly accessible directory, but read only, except for people in<br>
# the "staff" group<br>
;[public]<br>
; comment = Public Stuff<br>
; path = /home/samba<br>
; public = yes<br>
; writable = yes<br>
; printable = no<br>
; write list = @staff<br>
<br>
# Other examples.<br>
#<br>
# A private printer, usable only by fred. Spool data will be placed in fred's<br>
# home directory. Note that fred must have write access to the spool directory,<br>
# wherever it is.<br>
;[fredsprn]<br>
; comment = Fred's Printer<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -