当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > samba的配置[转载]

Unix/Linux
FreeBSD 数据转移办法
Freebsd 下运行QQ For Linux 的方法
FreeBSD, Debian, CentOS一个网卡绑定多个IP
freebsd下切换到root下 su: Sorry 的解决办法
Freebsd挂载光驱和软驱
FREEBSD下运行调试asterisk
一些 freebsd 的常用命令
笔记本上安装freebsd的小知识
FreeBSD系统下添加中文字体
FreeBSD挂载DOS分区,正确显示中文
FreeBSD挂载DOS分区时显示中文的方法
freebsd7.0安装系统图解(最新版)
服务器的时间同步设置方法
FreeBSD FTP 的架设教程
FreeBSD mpd VPN服务器安装步骤
更新FreeBSD Port Tree的几种方法小结
portupgrade 中文手册(翻译)
freebsd 服务器 ARP绑定脚本
在Ubuntu系统中定制 Compiz Fusion 特效
Ubuntu 7.10 绑定IP及MAC地址

Unix/Linux 中的 samba的配置[转载]


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 107 ::
收藏到网摘: n/a

SAMBA是一种能把 FreeBSD 的目录开放给Microsoft Windows 95/98/NT 利用网路芳邻方式存取的软体集。其实并不只针对 FreeBSD, 其它UN*X 也都可以使用,这对工作平台大部分时间是Microsoft family的人 在存取档案上,会是个比较方便的选择
SAMBA是一种能把 FreeBSD 的目录开放给Microsoft Windows 95/98/NT 利用网路芳邻方式存取的软体集。其实并不只针对 FreeBSD, 其它UN*X 也都可以使用,这对工作平台大部分时间是Microsoft family的人 在存取档案上,会是个比较方便的选择。 安装SAMBA 2.0.6 1.先以 root 身份 login,切换至/usr/ports/net/samba 准备安装SAMBA。 安装时只要在 SAMBA 的目录下执行 make install 即可 # root@ohaha[~] cd /usr/ports/net/samba/ # root@ohaha[/usr/ports/net/samba] make install 若无出现错误讯息则是安装完成,你可顺手将安装过程中解开的source清掉。 # root@ohaha[/usr/ports/net/samba] make clean 设定 SAMBA (smb.conf) 在安装完 SAMBA 後,它会放一份设定档例在/usr/local/etc 下, 先将例一份来修改成我们要的设定。 # root@ohaha[~] cd /usr/local/etc/ # root@ohaha[/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 出来。 ;