免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1267 | 回复: 0
打印 上一主题 下一主题

samba [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-04 10:15 |只看该作者 |倒序浏览

#cd /usr/ports/net/samba3
#make DEPENDS_TARGET=package package install clean
#cd /usr/local/etc
#cp smb.conf.default smb.conf
sam.conf.default是设定 SAMBA 的例档,真正读取的预设是 smb.conf,
  为了保留原始的例档以供日後参考用,所以我们用 cp 的方式出设定档,
  大致浏览过 smb.conf 後发现,它主要分成三大设定区,[globe]、[homes]、
  [printers],我没有印表机,所以没机会试[printers]相关部分。  
  我开 SAMBA 的目地是为了方便存取管理 ftp 并使用该台 FreeBSD 上
  的硬碟空间,所以等会设定档的最终目地便是开出一个分享目录 ftp,
  无须密码,但只允许我的工作机器去存取它。  
  在 smb.conf 中,所有的#和;都是解。#後接的是说明,
  ;後接的是指令,预设不打开该项设定,若想让它生效把分号拿掉即可。  
  以下只引出我有动过的地方,没提出的就是保留预设值。
#======================= Global Settings =====================================
[global]
# workgroup = NT-Domain-Name or Workgroup-Name, eg: REDHAT4
# 设定所在工作群组
   workgroup = center
# server string is the equivalent of the NT Description field
# 该主机的解
   server string = blah~
# This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# following example restricts access to two C class networks and
# the "loopback" interface. For more examples of the syntax see
# the smb.conf man page
# 允许连线的主机,允许 163.16.1.99 和 127.*.*.* 连线
   hosts allow = 163.16.1.99 127.
# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
# 我没有 printer ,所以有关 printer 的都会关掉
;   load printers = yes
# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
# 这里设定免密码的帐号,你设什麽帐号,连进来的 client就是那个身份,了吗?
# 所以我把这儿改成 ftp 这个帐号,因为我 share 出来的目录 owner 是 ftp
# 这样我才能以免密码又是 ftp 的身份对目录有完整的存取权。
# 不过记得,这儿填的帐号必须存在 /etc/passwd 中,否则会以 nobody 的身份签入。
   guest account = ftp
# this tells Samba to use a separate log file for each machine
# that connects
# 把 log 建个目录来放比较整齐,记得去 mkdir /var/log/samba 这个目录。
   log file = /var/log/samba/log.%m
# Security mode. Most people will want user level security. See
# security_level.txt for details.
# 设定安全层级,若要不用密码分享的话就要设成 share ,若设 user 的话会要求密码。
# 详情请见 docs/security_level.txt
   security = share
# 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
# 我的目的是不用密码存取,所以这项开不开都没影响,但若你想用密码来控制存取权限时,
# 请记得将此项打开,因为...详见 docs/ENCRYPTION.txt, Win95.txt 和 WinNT.txt。
;   encrypt passwords = yes
# for Traditional Chinese Users
# 若你想看到中文目录、档名的话,把 client code page=950 前的分号拿掉,
# 注意,coding system 那项留着别打开它,两个都打开的话反而会看不到中文
   client code page=950
;   coding system=cap
#============================ Share Definitions ==============================
# 接下来这一段就是 [homes] 和 [printers] 以及其它任何你想 share 出来的目录设定
# 区,我把 [homes] 也 mark 起来了,因为我不想 share 任何 home 出来。
;[homes-%U]
;   comment = Home Directories
;   path = /home/%U
;   user = %U
;   browseable = no
;   writeable = yes
# ftp
# 我加了这段,将 ftp 的目录开分享。一开始我们看到的 [ftp] 就是你分享出来的目录
# 在 95/98/NT 中会看到的资料夹名称,path 指向欲 share 目录的绝对路径,
# public = yes 是指定这个分享不须密码,writeable = yes 是指可对该分享做写入动作
# 注意一点,当有 public = yes 这行时,对该分享存取的身份就是之前在 [globe] 区,
# 我们所设定 guest account 的身份,若刚刚 guest account 没改成 ftp,那麽现在
# 即使有设 writeable = yes 也会因为 owner 不对而无法写入。
[ftp]
   path = /home/ftp
   public = yes
   writeable = yes                          
启动 SAMBA                          
在安装完 SAMBA 後,它丢了个启动的 script 在 /usr/local/etc/rc.d/,
档名是 samba.sh.sample,将之更名并 chmod 成可执行。      
#
[email=root@ohaha[/usr/local/etc/rc.d]root@ohaha[/usr/local/etc/rc.d[/email]
] mv samba.sh.sample samba.sh
#
[email=root@ohaha[/usr/local/etc/rc.d]root@ohaha[/usr/local/etc/rc.d[/email]
] chmod 750 samba.sh                       
你现在可以重新开机或者手动执行 samba.sh 来启动 SAMBA。         
#
[email=root@ohaha]root@ohaha[/email]
[~] /usr/local/etc/rc.d/samba.sh  
测试 SAMBAuh...接下来的不用说了吧,赶快用 95/98 的网路芳邻看看是否能成功
看到并存取分享出来的目录。
1:在/etc/rc.conf文件中,
在'usbd_enable="YES"'之后,添加如下一行:
samba_enable="YES"
这一步是必须的。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/8872/showart_60021.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP