📄 配置samba.htm
字号:
src="配置samba.files/button_go.gif" type=image>
</FONT></DIV></TD></TR>
<TR>
<TD noWrap>
<DIV align=center><INPUT maxLength=100 name=keyword2 size=30>
</DIV></TD></TR></TBODY></TABLE></FORM>
<TABLE align=center>
<TBODY>
<TR>
<TD><FONT class=normalfont>感谢<A
href="http://www.douzhe.com/">窦哲</A>提供空间</FONT></FONT> <A
href="http://www.douzhe.com/">http://www.douzhe.com/</A></TD></TR></TBODY></TABLE></TD>
<TD rowSpan=2><IMG border=0 name=header_r1_c7
src="配置samba.files/header_r1_c7.gif" width=26></TD>
<TD><IMG border=0 height=83 src="配置samba.files/spacer.gif"
width=1></TD></TR>
<TR>
<TD background=配置samba.files/bgline.gif><IMG border=0 height=22
name=header_r2_c1 src="配置samba.files/header_r2_c1.gif" width=296></TD>
<TD background=配置samba.files/bgline.gif colSpan=5>
<DIV align=right><FONT class=normalfont>当前位置: <A
href="http://www.douzhe.com/docs/linux/index.html">本站首页</A> <FONT
color=#ff6699>>></FONT> <A
href="http://www.douzhe.com/docs/linux/type23.html">samba</A> | <A
href="http://www.douzhe.com/docs/linux/copyright.html">版权说明</A></FONT></DIV></TD>
<TD><IMG border=0 height=22 src="配置samba.files/spacer.gif"
width=1></TD></TR></TBODY></TABLE>
<TABLE bgColor=#ffffff border=0 cellPadding=0 cellSpacing=10
width="100%"><TBODY>
<TR>
<TD>
<TABLE border=0 cellPadding=3 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD align=middle vAlign=top width="60%">
<TABLE background=配置samba.files/back.gif border=0
cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action=search.html method=get></FORM>
<TABLE border=0 cellPadding=0 cellSpacing=0
width="95%"><TBODY>
<TR>
<TD background=配置samba.files/bgi.gif
height=30></TD></TR></TBODY></TABLE>
<TABLE align=center border=0 cellPadding=3 cellSpacing=0
width="95%">
<TBODY>
<TR>
<TD>
<TABLE border=0 cellPadding=3 cellSpacing=0
width="100%">
<TBODY>
<TR>
<TD vAlign=top>
<P><FONT class=normalfont><B><FONT
color=blue>配置samba</FONT></B></FONT><BR><FONT
class=smallfont color=#ff9900>2004-04-23 15:18
pm</FONT><BR><FONT
class=normalfont>作者:王波<BR>来自:Linux知识宝库<BR>http://www.douzhe.com/docs/linux/<BR>Contact:
无名<BR><BR> 虽然预设情况已经适合大部分用户访问自己在伺服器上的个人目录的要求,但是为了充分发挥samba提供的功能
,与这些复杂多样的Windows网络相适应,就必须更改smb.conf
的设置。以提供更多的共享设置、伺服器设置
,以及用于支持包括比较简单的共享方式和复杂的域认证方式在内的认证方式。<BR> smb.conf中的语法非常简单,整个配置档案分为多个不同的部分,每个部分具有一个标题。使用方括号将标
题引起来,标题下包括一些相关设置,每一行都用于一个相关设置。设置档案中的每个部分或者定义了一个共享资源的名字,或者设置了一组参数。以下以预设
smb.conf为例,介绍smb.conf中的相关设置。<BR>*
[global]设置<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> [global]部分定义了伺服器本身使用的配置参数,以及其他共享资源部分使用的预设配置参数,因此相当重要。<BR>#
workgroup = NT-Domain-Name or Workgroup-Name,
eg: REDHAT4<BR>workgroup =
MYGROUP<BR> 工作组设置本地网路使用工作组名字(或者是NT域名字),这对于将正确进行浏览数据中非常重要。
否则,Windows客户就不能从其网路邻居中发现这个Samba伺服器。<BR># server
string is the equivalent of the NT Description
field<BR>server string = Samba
Server<BR> server
string是对于本地伺服器的简单描述,这些信息将作为这台伺服器的属性,返回给Browser,
显示在Windows客户中作为对这个伺服器的描述。<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> hosts
allow参数用于限制可以访问这台samba伺服器的客户机的IP地址范围,通过指定一系列网路地
址,使得只有这些网路中的电脑才能访问这台伺服器提供的资源,以提供安全限制。预设情况下,这行配
置被注释了,使得所有的客户都可以访问这台电脑,这样就存在一定的安全问题。<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> 这些设置是用于设置samba伺服器的印表机资源,load
printer=yes就允许samba伺服器对外共享服
务器的印表机。由于不同的Unix系统中会使用不同的打印系统和不同的打印设置档案,因此需要设置正确的
printcap和printing类型,对于使用BSD打印系统的FreeBSD来讲,打印系统为BSD,使用的设置档案为
printcap,这些是预设设置,不需要改动。对于使用Unix System
V打印系统的Samba,则需要重新进行 设置。<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> 由于Mircrosoft客户没有用户的概念,因此有时会用没有用户和密码的请求访问伺服器,就需
要将这个没有用户的请求映射为系统中的某个用户,Samba伺服器才能安全的访问系统。guest
account
就定义这样的请求在Unix下对应的用户权限。为了安全的原因,不能让这个帐户在系统中有可写的权限
,通常可以增加一个专用帐户,如pcguest。如果这个设置被注释的情况下,系统预设使用nobody执行
Windows客户的请求。一些使用者建议不要使用nobody用户,因为系统中的很多程序预设都使用它,因
此就会有安全问题。<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> 这里定义samba的日志档案为/var/log目录下的以log为前缀的档案,%m用于代表从访问的NetBIOS
电脑名,如果使用的用户级认证,还可以使用%U表示不同的登录用户。例如从一台名字为win95c的计算
机访问samba伺服器的日志,将记录在/var/log/log.win95c档案中。max
log size定义每个日志档案的存 储限制。<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> 在SMB协议中,有多个不同的认证方式,包括简单的共享级认证和用户级认证。Unix为多用户操作系统,预设
就使用用户级认证方式。当使用用户级认证的时候,Samba伺服器使用Unix操作系统的用户和密码(来自/etc/passwd
)对用户进行认证,这是一种独立的认证方式。而有时候希望所有的伺服器使用同一个认证数据库进行统一认证
,因此就导致出现了基于域的统一认证模式。在一个域中,用户只需要通过域控制器进行认证即可,域中其他SMB伺服器就
将认可域控制器的认证。<BR> 为了使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中的缺
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -