67 FreeBSD连载:配置samba( 二 )


# this tells Samba to use a separate log file for each machine# that connectslog file = /var/log/log.%m # Put a capping on the size of the log files (in Kb).max log size = 50这里定义samba的日志文件为/var/log目录下的以log为前缀的文件,%m用于代表从访问的NetBIOS计算机名,如果使用的用户级认证,还可以使用\u表示不同的登录用户 。例如从一台名字为win95c的计算机访问samba服务器的日志,将记录在/var/log/log.win95c文件中 。max log size定义每个日志文件的存储限制 。
# Security mode. Most people will want user level security. See# security_level.txt for details.security = user# Use passWord server option only with security = server;password server = # You may wish to use password encryption. Please read# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.# Do not enable this option unless you have read those documents;encrypt passwords = yes在SMB协议中,有多个不同的认证方式,包括简单的共享级认证和用户级认证 。Unix为多用户操作系统,缺省就使用用户级认证方式 。当使用用户级认证的时候,Samba服务器使用Unix操作系统的用户和口令(来自/etc/passwd)对用户进行认证,这是一种独立的认证方式 。而有时候希望所有的服务器使用同一个认证数据库进行统一认证,因此就导致出现了基于域的统一认证模式 。在一个域中,用户只需要通过域控制器进行认证即可,域中其他SMB服务器就将认可域控制器的认证 。
为了使Samba服务器支持域认证方式,可以有两种不同的设置方式,一种为真正的域认证,另一种为服务器认证方式,将Samba服务器配置为通过服务器验证用户,这需要指定security=server,以及指定passwordserver的名字为NT的域控制器 。认证服务器的方式不能事先域认证方式提供的一些特征,但它的适用范围并不仅限于域,使用工作组的网络也能通过统一的认证服务器来使用统一认证模式 。设置域认证方式在后面进行详细解释 。
在Windows NT 4及Windows 98之后,客户和服务器之间进行认证时,口令不再以明文的方式在网络中传输了 。为了支持加密口令传输,需要设置encrypt passwords选项 。同样,这也需要其他复杂的设置 。
# 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;include = /usr/local/etc/smb.conf.%m系统管理员可以为每个特定的计算机定制一个特定的配置文件,那里的设置将覆盖smb.conf中的缺省设置 。这样就可以针对不同的计算机提供不同的配置 。
# Most people will find that this option gives better performance.# See speed.txt and the manual pages for detailssocket options = TCP_NODELAYsocket参数用于配置对TCP的处理方式,以适合Microsoft客户的特征 。Microsoft习惯为每个很短的会话都建立单独的连接,而不是使用一个连接进行多次传输,这样在传输中就需要进行多次连接会话设定过程,对性能有一定影响 。为了改善性能,需要设置TCP_NODELAY或IPTOS_LOWDELAY选项 。
# 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如果计算机上有多个网络界面,那么就需要让samba向多个界面广播b-node广播包,以及为这些界面提供资源服务,否则samba就会只向某一个界面提供网络服务 。当然也可以设置这个参数,使得samba只服务于某个指定的网络,而不是服务器连接所有的网络 。
# 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# Use only if you have an NT server on your network that has been# configured at install time to be a primary domain controller.;domain controller = 这些设置选项主要用于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服务器之间进行选择时才有意义 。

推荐阅读