223.html
来自「本文详细介绍了学习FREEBSD的一些命令」· HTML 代码 · 共 36 行 · 第 1/2 页
HTML
36 行
<tr><td> </td></tr>
<tr><td align=left><i>作者:</i>王波</td></tr>
<tr><td> </td></tr>
<tr><td><font color=white>虽然缺省情况已经适合大部分用户访问自己在服务器上的个人目录的要求,但是为了充分发挥samba提供的功能,与这些复杂多样的Windows网络相适应,就必须更改smb.conf的设置。以提供更多的共享设置、服务器设置,以及用于支持包括比较简单的共享方式和复杂的域认证方式在内的认证方式。<br><br> smb.conf中的语法非常简单,整个配置文件分为多个不同的部分,每个部分具有一个标题。使用方括号将标题引起来,标题下包括一些相关设置,每一行都用于一个相关设置。设置文件中的每个部分或者定义了一个共享资源的名字,或者设置了一组参数。以下以缺省smb.conf为例,介绍smb.conf中的相关设置。<br><br><br>[global]设置<br><br># This is the main Samba configuration file. You should read the<br># smb.conf(5) manual page in order to understand the options listed<br># here. Samba has a huge number of configurable options (perhaps too<br># many!) most of which are not shown in this example<br>#<br># Any line which starts with a ; (semi-colon) or a # (hash)<br># is a comment and is ignored. In this example we will use a #<br># for commentry and a ; for parts of the config file that you<br># may wish to enable<br>#<br># NOTE: Whenever you modify this file you should run the command "testparm"<br># to check that you have not many any basic syntactic errors.<br>#<br>#======================= Global Settings =====================================<br>[global]<br> <br> <br><br> [global]部分定义了服务器本身使用的配置参数,以及其他共享资源部分使用的缺省配置参数,因此相当重要。<br><br># workgroup = NT-Domain-Name or Workgroup-Name, eg: REDHAT4<br> workgroup = MYGROUP<br> <br> <br><br> 工作组设置本地网络使用工作组名字(或者是NT域名字),这对于将正确进行浏览数据中非常重要。否则,Windows客户就不能从其网络邻居中发现这个Samba服务器。<br><br># server string is the equivalent of the NT Description field<br> server string = Samba Server<br> <br> <br><br> server string是对于本地服务器的简单描述,这些信息将作为这台服务器的属性,返回给Browser,显示在Windows客户中作为对这个服务器的描述。<br><br># This option is important for security. It allows you to restrict<br># connections to machines which are on your local network. The<br># following example restricts access to two C class networks and<br># the "loopback" interface. For more examples of the syntax see<br># the smb.conf man page<br>; hosts allow = 192.168.1. 192.168.2. 127.<br> <br> <br><br> hosts allow参数用于限制可以访问这台samba服务器的客户机的IP地址范围,通过指定一系列网络地址,使得只有这些网络中的计算机才能访问这台服务器提供的资源,以提供安全限制。缺省情况下,这行配置被注释了,使得所有的客户都可以访问这台计算机,这样就存在一定的安全问题。<br><br># If you want to automatically load your printer list rather<br># than setting them up individually then you'll need this<br> load printers = yes<br> <br># you may wish to override the location of the printcap file<br>; printcap name = /etc/printcap<br> <br># on SystemV system setting printcap name to lpstat should allow<br># you to automatically obtain a printer list from the SystemV spool<br># system<br>; printcap name = lpstat<br> <br># It should not be necessary to specify the print system type unless<br># it is non-standard. Currently supported print systems include:<br># bsd, sysv, plp, lprng, aix, hpux, qnx<br>; printing = bsd<br> <br> <br><br> 这些设置是用于设置samba服务器的打印机资源,load printer=yes就允许samba服务器对外共享服务器的打印机。由于不同的Unix系统中会使用不同的打印系统和不同的打印设置文件,因此需要设置正确的 printcap和printing类型,对于使用BSD打印系统的FreeBSD来讲,打印系统为BSD,使用的设置文件为 printcap,这些是缺省设置,不需要改动。对于使用Unix System V打印系统的Samba,则需要重新进行设置。<br><br># Uncomment this if you want a guest account, you must add this to /etc/passwd<br># otherwise the user "nobody" is used<br>; guest account = pcguest<br> <br> <br><br> 由于Mircrosoft客户没有用户的概念,因此有时会用没有用户和口令的请求访问服务器,就需要将这个没有用户的请求映射为系统中的某个用户,Samba服务器才能安全的访问系统。guest account 就定义这样的请求在Unix下对应的用户权限。为了安全的原因,不能让这个帐户在系统中有可写的权限,通常可以增加一个专用帐户,如pcguest。如果这个设置被注释的情况下,系统缺省使用nobody执行 Windows客户的请求。一些使用者建议不要使用nobody用户,因为系统中的很多程序缺省都使用它,因此就会有安全问题。<br><br># this tells Samba to use a separate log file for each machine<br># that connects<br> log file = /var/log/log.%m<br> <br># Put a capping on the size of the log files (in Kb).<br> max log size = 50<br> <br> <br><br> 这里定义samba的日志文件为/var/log目录下的以log为前缀的文件,%m用于代表从访问的NetBIOS 计算机名,如果使用的用户级认证,还可以使用%U表示不同的登录用户。例如从一台名字为win95c的计算机访问samba服务器的日志,将记录在/var/log/log.win95c文件中。max log size定义每个日志文件的存储限制。<br><br># Security mode. Most people will want user level security. See<br># security_level.txt for details.<br> security = user<br># Use password server option only with security = server<br>; password server = <NT-Server-Name><br> <br># You may wish to use password encryption. Please read<br># ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.<br># Do not enable this option unless you have read those documents<br>; encrypt passwords = yes<br> <br> <br><br> 在SMB协议中,有多个不同的认证方式,包括简单的共享级认证和用户级认证。Unix为多用户操作系统,缺省就使用用户级认证方式。当使用用户级认证的时候,Samba服务器使用Unix操作系统的用户和口令(来自/etc/passwd )对用户进行认证,这是一种独立的认证方式。而有时候希望所有的服务器使用同一个认证数据库进行统一认证,因此就导致出现了基于域的统一认证模式。在一个域中,用户只需要通过域控制器进行认证即可,域中其他SMB服务器就将认可域控制器的认证。<br><br> 为了使Samba服务器支持域认证方式,可以有两种不同的设置方式,一种为真正的域认证,另一种为服务器认证方式,将Samba服务器配置为通过服务器验证用户,这需要指定security=server,以及指定password server的名字为NT的域控制器。认证服务器的方式不能事先域认证方式提供的一些特征,但它的适用范围并不仅限于域,使用工作组的网络也能通过统一的认证服务器来使用统一认证模式。设置域认证方式在后面进行详细解释。<br><br> 在Windows NT 4及Windows 98之后,客户和服务器之间进行认证时,口令不再以明文的方式在网络中传输了。为了支持加密口令传输,需要设置encrypt passwords选项。同样,这也需要其他复杂的设置。<br><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> <br> <br><br> 系统管理员可以为每个特定的计算机定制一个特定的配置文件,那里的设置将覆盖smb.conf中的缺省设置。这样就可以针对不同的计算机提供不同的配置。<br><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> <br> <br><br> socket参数用于配置对TCP的处理方式,以适合Microsoft客户的特征。Microsoft习惯为每个很短的会话都建立单独的连接,而不是使用一个连接进行多次传输,这样在传输中就需要进行多次连接会话设定过程,对性能有一定影响。为了改善性能,需要设置TCP_NODELAY或IPTOS_LOWDELAY选项。<br><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> <br> <br><br> 如果计算机上有多个网络界面,那么就需要让samba向多个界面广播b-node广播包,以及为这些界面提供资源服务,否则samba就会只向某一个界面提供网络服务。当然也可以设置这个参数,使得samba 只服务于某个指定的网络,而不是服务器连接所有的网络。<br><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><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> <br> <br><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><br> 由于Unix及Samba服务器在同样硬件配置下具有更高的网络性能,因此一般情况下,使用Samba服务器作Browser更佳。当然可能在Samba服务器启动之前,网络中都已经存在了Browser了,一般情况下不必重新进行推举过程,让网络中的现有Browser继续发挥作用。如果希望Samba服务器总是成为Browser,可以设置当Samba服务器启动时,迫使网络中重新进行推举过程,这需要设定perfered master参数。<br><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><br> 但是如果网络使用的是NT的域方式,就要使用NT的域控制器作为Domain master Browser ,不要设置与NT域控制器同一个子网中的Samba服务器的domain brower与browser功能,以免它和域控制器竞争。不让Samba服务器和NT域控制器竞争的原因是由于Windows NT中域控制器还涉及域认证(不是认证域用户,而是认证域上的合法成员计算机),SMB协议中各种复杂功能交错混合,浏览和认证两种不同的功能竟也混合在一起。由于域控制器完成的域认证任务,Samba服务器不能够完成,因此为了避免与NT域控制器相互冲突,最好使用域控制器作Domain master Browser。<br><br> 让Samba服务器了解当前域中存在的域控制器的方法是指定在设置文件中指定域基本控制器PDC(primary Domain Controller)的NetBIOS名字,这需要使用domain controller参数进行设置。<br><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 = \\%L\Profiles\%U<br> <br> <br><br> 当用户通过一台Windows 9x客户机使用用户级认证访问网络时,他可以选择登录进网络中的域。这意味着他不但要在SMB服务器中进行验证,而且会执行服务器中相应目录中的登录脚本,以自动执行一些相关设置。通常这种登录功能是由Windows NT服务器来执行的,然而Samba服务器也能完成这个任务,但必须设定domain logons 参数。此后就可以对不同的客户计算机或不同用户指定相应的登录脚本。这个功能还必须要求在本配置文件后面设置 netlogon共享选项,以便客户机能访问相应的登录脚本。<br></font></td></tr>
<tr><td> </td></tr>
<tr><td align=right><i>来源:</i><a href="javascript:if(confirm('http://freebsd.online.ha.cn/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://freebsd.online.ha.cn/'" tppabs="http://freebsd.online.ha.cn/">http://freebsd.online.ha.cn/</a></td></tr>
</table>
<p> </p>
<p> </p>
<p> </p>
声明:本站的文章和软件是本人从网上收集整理的(除本人的作品之外),所有版权属于作者,<br>
如有侵犯您的权益,请指出,本站将立即改正,谢谢.
<hr width=500>
<br>
<font color=#ffffff>Copyright 2000 <a href="javascript:if(confirm('http://www.newok.com/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.newok.com/'" tppabs="http://www.newok.com/" class=t1>www.newok.com</a></font>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?