Chinaunix首页 | 论坛 | 博客
  • 博客访问: 532535
  • 博文数量: 119
  • 博客积分: 3167
  • 博客等级: 中校
  • 技术积分: 1215
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-20 21:21
文章分类

全部博文(119)

文章存档

2015年(21)

2012年(4)

2011年(1)

2007年(11)

2006年(50)

2005年(32)

分类: LINUX

2005-12-20 21:49:00

             samba配置(全局)         

详细的安装(包括编译参数)和配置步骤 适合LFS

SAMBA作为PDC

                                                     

Samba软件包的内容 

1. SMB服务器smbd:为SMB客户机如Windows 9x/NT等提供Windows NTLan Manager风格的文件和打印服务。 

 

2.NetbiosRFC1001/RFC1002)名字服务器nmbd:可以提供浏览支持。用户甚至可以用Samba作为局域网的主浏览服务器。 

 

3. SMB客户程序smbclient:类似ftp程序,用以从UNIXNetware和其他操作系统上访问SMB服务器上的资源(如文件、打印机) 

 

4.SMB客户服务程序的tar扩展smbtar:用以方便地拷贝SMB服务器上的文件。 

 

5. smbstatus 用于列示当前 samba 的联接状态

 

6. testparm

 

7. nmblookup

 

8. smbmount

配置SAMBA /etc/samba/smb.conf

smb.conf文件的语法格式包含了许多区段(section),每一个区段都有一个名字,用方括号括起来,其中比较重要的区段是[global][homes][printers][global]区段定义了全局参数,[homes]区段定义了用户的主目录文件服务,[printers]区段定义了打印机共享服务。 

 

[global]  #全局配置设定

# workgroup = NT的域名或者工作组名 

 

workgroup = MYGROUP 

 

 

# server string 等价于NT的描述域(description field 

 

server string = Samba Server 

 

 

# 下面的选项对于安全十分重要,它限制连接到当前服务器的本地网络的IP地址。 

 

# 下面的例子中,只允许两个C类网络地址和‘loopback’界面访问SMB服务器。 

 

# 更多信息,查看smb.conf的手册页。如果该选项要激活,把分号去掉。 

 

; hosts allow = 192.168.1. 192.168.2. 127. 

 

 

# 自动加载打印机,而不是每次单独设置 

 

printcap name = /etc/printcap 

 

load printers = yes 

 

 

# 除非你的打印系统的类型不标准,否则不用设置下面的参数,当前支持的打印 

 

# 系统有:bsd, sysv, plp, lprng, aix, hpux, qnx 

 

; printing = bsd 

 

 

# 如果希望建立客户账号,激活此选项,同时把此账号加入/etc/passwd文件中 

 

# 否则使用用户"nobody"作为客户账号 

 

; guest account = pcguest 

 

 

# 对从不同机器建立的连接建立不同的日志文件 

 

log file = /var/log/samba/log.%m 

 

# 限制日志文件的最大尺寸(单位是KB 

 

max log size = 50 

 

#这三行设置超时,否则mount上的设备umount不掉,一直提示busy 
change notify timeout = 30  
deadtime = 1  
keepalive = 0  

 

#这三行是umask的设置,看情况设置吧 

create mask = 0755 

force create mode = 0755 

force directory mode = 0755 

 

# 安全模式,大多数用户希望用户级的安全, 

 

# 详细信息参考security_level.txt文件。 

 

security = user 

 

 

# security = server时使用口令服务器选项 

 

; password server = 

 

# 输入口令应该和真实口令的前面Password Level个字符相符合 

 

# 输入用户名应该和真实用户名的前面username level个字符相符合 

 

; password level = 8 

 

; username level = 8 

 

 

# 用户可能需要使用口令加密,在使用下面的选项之前,请仔细 

 

# 阅读ENCRYPTION.txtWin95.txtWinNT.txt文件。 

 

# 用户密码文件可以存放在/etc/passwd文件中 

 

; encrypt passwords = yes 

 

; smb passwd file = /etc/smbpasswd 

 

# 如果要允许在Linux中的密码改动更新Linux系统的密码,就需要下面的选项. 

 

# NOTE: Use these with ’encrypt passwords’ and ’smb passwd file’ above. 

 

# NOTE2: You do NOT need these to allow workstations to change only 

 

# the encrypted SMB passwords. They allow the Unix password 

 

# to be kept in sync with the SMB password. 

 

; unix password sync = Yes 

 

; passwd program = /usr/bin/passwd %u 

 

; passwd chat = *New*UNIX*password* %n *ReType*new*UNIX*password* %n *passwd:*all*authentication*tokens*updated*successfully* 

 

 

# Unix用户可以映射成不同SMB用户名 

 

; username map = /etc/smbusers 

 

# 对每个不同的客户机使用不同的配置文件,%m代表客户机的Netbios名字 

 

; include = /etc/smb.conf.%m 

 

# 下面的选项可以提高服务器的性能,特别是使用smbmount挂卸SMB文件系统时。 

 

# 参考speed.txt文件。 

 

socket options = TCP_NODELAY  SO_RCVBUF=8192 SO_SNDBUF=8192

 

 

# 如果SMB服务器使用了多个网卡,必须在下面列出并进行配置 

 

; interfaces = 192.168.12.2/24 192.168.13.2/24 

 

 

# Configure remote browse list synchronisation here 

 

# request announcement to, or browse list sync from: 

 

# a specific host or from / to a whole subnet (see below) 

 

; remote browse sync = 192.168.3.25 192.168.5.255 

 

# Cause this host to announce itself to local subnets here 

 

; remote announce = 192.168.1.255 192.168.2.44 

 

# 浏览器控制选项:如果你不想让Samba服务器成为网络中的主浏览器, 

 

# 那么local master设置为no,否则设置为yes(此时将参加主浏览器的竞争) 

 

; local master = no 

 

 

# 竞争主浏览器时对自身的评价 ,需要SAMBA逞能为成为主browser主的话可以设置为65

 

; 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 = 

 

# 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 = \%LProfiles\%U  

 

# All NetBIOS names must be resolved to IP Addresses  

 

# ’Name Resolve Order’ allows the named resolution mechanism to be specified 

 

# the default order is "host lmhosts wins bcast". "host" means use the unix  

 

# system gethostbyname() function call that will use either /etc/hosts OR  

 

# DNS or NIS depending on the settings of /etc/host.config, /etc/nsswitch.conf  

 

# and the /etc/resolv.conf file. "host" therefore is system configuration  

# dependant. This parameter is most often of use to prevent DNS lookups  

 

# in order to resolve NetBIOS names to IP Addresses. Use with care!  

 

# The example below excludes use of name resolution for machines that are NOT 

 

# on the local network segment  

 

# - OR - are not deliberately to be known via lmhosts or via WINS. 

将主机名解析成IP的顺序 默认顺序为 host lmhosts wins bcost . host Linux 系统调用gethostbyname()函数 , 它依赖于/etc/hosts /etc/host.config , /etc/nsswitch.con 等等   一般不需要改动

 

; name resolve order = wins lmhosts bcast  

 

# WindowsInternet命名服务支持区段: 

 

# WINS支持—要求Sambanmbd进程激活WINS服务  

 

; wins support = yes  

 

# WINS服务器—要求Sambanmbd进程成为一个WINS客户  

 

# 注意:Samba可以成为一个WINS服务器或者客户,但是不能同时选择两个身份 

 

; 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 built-in default for versions 1.9.17 is yes, 

 

# this has been changed in version 1.9.18 to no. 

 

dns proxy = no 

 

# Case Preservation can be handy - system default is _no_ 

 

# NOTE: These can be set on a per share basis 

 

; preserve case = no 

 

; short preserve case = no 

 

# Default case is normally upper case for all DOS files 

默认所有DOS文件名都当作大写,去掉下面注释改为小写

  default case = lower 


日志标题:samba配置(共享配置)
发表时间:2005-9-8 5:23:30

共享服务的定义

 

[homes] 

 

# 说明文字,当一个客户机列出服务器的共享资源时,给出该服务器的描述 

 

comment = Home Directories 

 

# 当一个客户程序以guest身份列出服务器的共享服务时,homes服务将不出现在列表中, 

 

# 但是为本机的真实用户创建的主目录服务继承[global]区段的设定(browseable=yes 

 

browseable = no 

 

writable = yes 

 

 

# Un-comment the following and create the netlogon directory for Domain Logons 

 

; [netlogon] 

 

; comment = Network Logon Service 

 

; path = /home/netlogon 

 

; guest ok = yes 

 

; writable = no 

 

; share modes = no 

 

 

 

# Un-comment the following to provide a specific roving profile share 

Roving profile share 临时的共享

# the default is to use the user’s home directory 

 

;[Profiles] 

 

; path = /home/profiles 

 

; browseable = no 

 

; guest ok = yes 

 

 

 

# 定义打印机共享,使用BSD风格的打印系统不必单独定义每一个打印机 

 

[printers] 

 

comment = All Printers 

 

# path指定的目录必须事先创建,否则不能使用 

 

path = /var/spool/samba 

 

browseable = no 

 

# 设定public = yes允许用户(guest account)使用打印机 

 

guest ok = no 

 

# printable服务总是允许往服务目录写文件,但是只能通过打印缓存操作实现 

 

writable = no 

 

printable = yes 

 

# 设置网络用户共享文件的临时区域,每个人可以在这里存放文件供别人使用 

 

;[tmp] 

 

; comment = Temporary file space 

 

; path = /tmp 

 

; read only = no 

 

; public = yes 

 

# 一个共享的目录,普通的访问者只读,属于staff组的用户可以读写 

 

;[public] 

 

; comment = Public Stuff 

 

; path = /home/samba 

 

; public = yes 

 

; writable = yes 

 

; printable = no 

 

; write list = @staff 

 

# Other examples. 

 

# 

 

# 一个私有的打印机,只供fred使用,打印缓存存放在fred的主目录里# home directory. # 注意fred必须对打印缓存的目录有写权 

 

;[fredsprn] 

 

; comment = Fred’s Printer 

 

; valid users = fred 

 

; path = /homes/fred 

 

; printer = freds_printer 

 

; public = no 

 

; writable = no 

 

; printable = yes 

 

 

# 私有的目录,只供用户fred使用,fred管理员在2009年8月13日编辑了该文章文章。 -->

阅读(880) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~