ChinaUnix.net
 >> ChinaUnix.net > BSD

在FreeBSD4.4r上安装samba2.2.3a

作者:zyme     发表时间:2002/03/14 09:32pm

[这个贴子最后由zyme在 2002/07/22 02:05pm 编辑]

在FreeBSD4.4r上安装samba2.2.3a

zyme,zyme@yeah.net,QQ:710055,2002.3.15

一:关于samba
简单点认为:就是实现unix之类操作系统与windows之类操作系统文件夹、打印机共享!
下载samba2.2.3a(目前最新的了)http://us1.samba.org/samba/ftp/samba-2.2.3a.tar.gz。
其它的我不想再废话了,因为到处都在讲它。

二:安装samba

1)FreeBSD4.4r自己带了samba2.0.10。如果你装了,且要更新的话,最好:
#cd /usr/ports/net/samba*
#make deinstall
删除或移走与samba相关的文件
2)如果你手动装了较新的samba,相要更新的话,最好:
#cd /usr/src/samba/samba2.x.x(这里为你当初装的源目录)
#make uninstall
删除或移走与samba相关的文件
3)安装新的samba2.2.3a(注意:如果安装过程中若有错产生,最好记下信息)
#cp samba2.2.3a.tar.gz /usr/src/samba/samba2.2.3a(养成好习惯,把下载下的文件拷贝到/usr/src/???下装)
#cd /usr/src/samba
#tar zxvf samba2.2.3a(之后解出很多文件在./samba2.2.3a下)
#cd samba2.2.3a/source
#sh config.my(参见config.my之内容;或者#./configure,但这样少些功能且麻烦。之后出现一长串信息,生成四个新文件)
#make(根据config.my生成安装变量之类的,编译.c之类的许多文件。一长串信息)
#make install(安装/拷贝samba的文件到系统中,可以看看屏幕上的,了解它们都安装到哪里去了)
#(如果成功的话就完成安装了。之后可以在这个目录里用#make uninstall卸载)
三:设置samba
1)关掉/etc/services中netbios的设置,即在137,138,139端口最前加上#号。
2)根据在config.my中一些目录的设置,到各目录修改/生成/添加文件。
#cd /usr/local/etc
#ee smb.conf(参见我的smb.conf内容。这是samba的配置文件)
#cd /var/samba
#mkdir locks
#cd /usr/local/bin(samba的扩展功能文件在这里)
#./testparm(测试/usr/local/etc/smb.conf是配置否正确。如果对,进行下一步,不对就改相应的呗)
#./smbpasswd -a 用户名(这里用户名为系统中已有账号的用户,但与系统账号密码无关。生成文件/usr/local/private/smbpasswd)
#cd /usr/local/sbin(samba的三个文件smbd,nmbd,swat在这里)
#./smbd -D
#./nmbd -D -d1
#ps -ax | grep mbd(应该看到两个进程:smbd和nmbd)
四:使用samba
1)服务器是自动启动:在/etc/rc.local中加两行/usr/local/sbin/smbd -D和/usr/local/sbin/nmbd -D -d1就行了。
2)在windows中访问:在这台服务器的局域网中的windows电脑上,网上邻居里,就能看到“新的成员”samba了。输入用户名和密码访问吧。(其中具体内容要看smb.conf中的设置)
五:参考文件:
1)/usr/src/samba2.2.3a/source/config.my(一句话)
./configure --prefix=/usr/local --sysconfdir=/usr/local/etc --localstatedir=/var/samba --with-lockdir=/var/samba/locks --with-privatedir=/usr/local/private --with-configdir=/usr/local/etc --with-logfilebase=/var/samba --with-smbwrapper --with-dce-dfs --with-pam --with-pam_smbpass --with-msdfs --with-vfs
2)/usr/local/etc/smb.conf(多行)
[global]
  workgroup = mygroup #我的内容工作组名
  server string = Neighbor File Server
  hosts allow = 192.168.1. 127. #允许192.168.1.0/24网段电脑访问
  load printers = no
  log file = /var/samba/%m.log
  max log size = 150
  security = user #用户级访问要帐号
  encrypt passwords = yes #用户级访问要密码
  socket options = TCP_NODELAY
  interfaces = 192.168.1.1/24 #这台电脑的内网网卡IP
  netbios name = server #windows网上邻居看到的名字
  dns proxy = no
  client code page=936 #使用简体中文,950为繁体中文
  config file = /usr/local/etc/smb.conf
  nt acl support = true

[Private] #私人目录 如果要某用户有写权限,要把这个目录归这个用户所有。
  comment = Neighbor Private Files
  path = /neighbor/private #当然这个目录要先建好
  writeable = yes

[Public] #共享目录
  comment = Neighbor Public Files
  path = /neighbor/public #当然这个目录要先建好

(未完待续)


此文章相关评论:
该文章有5个相关评论如下:(点这儿可以发表评论)
zyme 发表于: 2002/03/14 09:33pm
如果大家有更好意见,欢迎提出!谢谢
 
MaxBSD 发表于: 2002/03/14 10:25pm
[这个贴子最后由MaxBSD在 2002/03/14 10:33pm 编辑]

Here's my smb.conf file which i have been using for a long time, provided here for your reference...

The file configures the samba to served as a Primary Domain Controller.(NT)


# smb.conf
# from UNKNOWN (0.0.0.0)

# Global parameters
[global]
default case = lower
remote announce = 172.16.1.255/lan
status = yes
domain master = yes
read raw = no
domain logons = Yes
printing = bsd
preferred master = yes
logon path = \\%N\profile\%U
server string = BSD
getwd cache = yes
workgroup = OfficeA
mangle case = yes
protocol = NT1
logon script = logon.bat
netbios name = freebsd
case sensitive = no
keepalive = 30
client code page = 936
logon drive = z:
log level = 1
printer admin = @adm, root
remote browse sync = 172.16.0.255 172.16.1.255
auto services = software
log file = /var/log/smblog.%m
printcap name = /etc/printcap
max log size = 50
printer = lp
time server = true
locking = yes
dns proxy = No
preserve case = yes
max xmit = 2048
logon home = \\%N\%U
encrypt passwords = yes
mangled names = yes
path = /var/spool/output/lpd
domain admin group = @adm
update encrypted = yes
socket options = TCP_NODELAY
load printers = yes
local master = yes
short preserve case = yes
security = user
coding system = cap
os level = 65
name resolve order = wins lmhosts bcast
wins support = true
debug level = 1

[netlogon]
   path = /usr/local/samba/netlogon
   writeable = no
   browseable = no
   available = yes
   write list = @adm

[profile]
   path = /home/share/profiles
   #path = /tmp
   writeable = yes
   available = yes
   guest ok = no
   browseable = yes
   create mask = 0700
   directory mask = 0700

[homes]
   comment = Home directories
   #browseable = no
   available = oes
   browseable = yes
   guest ok = no
   read only = no
   printable = no
   create mode = 0700

[Temp]
   comment = the garbage dump
   browseable = yes
   available = yes
   public = yes
   read only = no
   printable = no
   path = /usr/tmp
   create mask = 0777

[Mp3]
   comment = Public Mp3 clips
   level2 oplocks = true
   fake oplocks = true
   path = /home/share/mp3
   available = yes
   public = yes
   writeable = yes
   printable = no
   write list = @adm
   create mask = 0774
   force create mode = 0774
   directory mask = 0775
   force directory mode = 0775


[Software]
       comment = Public domain Software
       level2 oplocks = true
       fake oplocks = true
       path = /home/share/software
       available = yes
       public = yes
       writeable = yes
       printable = no
       write list = @adm
       create mask = 0774
       force create mode = 0774
       directory mask = 0775
       force directory mode = 0775

[printer]
printable = yes
guest ok = yes
printer driver = HP LaserJet 4L
write list = @adm
lpq command = /usr/bin/lpq %p
# printer = raw
print command = /usr/bin/lpr -r -P%p %s ; rm %s
path = /var/spool/output/%p
comment = Printers
guest account = guest
browseable = yes
writable = yes
lprm command = /usr/bin/lprm -P%p %j
public = yes

[print$]
   path = /home/share/printers
   guest ok = yes
   browseable = yes
   read only = yes
   write list = @adm

 
zyme 发表于: 2002/03/14 10:53pm
谢谢,好详细哟。

我有这样个想法,让samba从mysql数据库中取得认证帐号,就像apache支持目录的mysql帐号认证哪样!.....

 
zyme 发表于: 2002/03/15 11:21pm
朋友遇到的错误情况:
在win之网上邻居中点server
1)出现"拒绝访问":[global]部分配置出错。请用testparm检查。
2)出现"找不到网络路径":netbios name 与 hostname不相同,请改成相同。
3)出现"输入用户名和密码"后"无权访问":smbpasswd没建好。
4)点一个共享目录说"找不到网络名":共享目录没建好。所有权没设好。
5)出现"没有启动网络服务":smbd -D进程没运行起。
6)看不到server电脑,但用\\1.2.3.4(IP)访问得到:nmbd -D -d1没运行起。
............
 
qintl 发表于: 2002/03/16 11:32am
我想,如果能ping通机器名(也就是netbios name)而不能正确访问的话,问题大都出现在smb.conf文件的配置上,我用RedHat7.2下samba的smb.conf文件替换Freebsd下的smb.conf,结果,samba运行正常,我看了看这两个文件,区别也不算太大,具体到哪一点,我也搞不清楚。反正我知道,smb.conf文件的正确配置很重要^_^
 
 

Copyright © ChinaUnix.net  *  转载请注明出处及作者