搞了一上午,发现跟我无关啊。。。

从 samba wiki 上找到的答案 https://wiki.samba.org/index.php/Windows7

记下来,算是给各位提个醒。。。

支持Windows 7 域登陆的 Samba 版本

截止到 2011年4月6号的测试,支持 Windows 7 和 Windows 2008 使用 Samba 域控制器的在如下的Samba版本中添加:

  • Samba 3.4 或之后
  • Samba 3.3.5 或之后
  • Samba 3.3.2, 3.3.3 和 3.3.4 (with NOTES)
  • Samba 3.2.12 或之后

如果你使用更旧的版本,那么 Windows 7 仍然可以加入到 Samba 域中,但是在重启之后,你将会接收到一个错误信息:"the trust relation between this workstation and the primary domain failed",然后就没有人可以作为域用户登陆了。

我使用的 Linux 是 CentOS 5.5,Samba版本是3.0.33,所以好像总是登陆不到上面去。按理CentOS 应该会有修复的吧?

Windows 7 注册表设置

添加如下注册表内容:

HKLM\System\CCS\Services\LanmanWorkstation\Parameters
DWORD DomainCompatibilityMode
= 1
DWORD DNSNameResolutionRequired
= 0

Samba 同时也提供了注册表补丁文件,可以从Samba源代码:$SOURCE/docs-xml/registry/Win7_Samba3DomainMember.reg 或者Samba Bugzilla:https://bugzilla.samba.org/attachment.cgi?id=4988&action=view 获得。设置补丁之后之后需要重启 Windows 或者重启 LanmanWorkstation 服务。

加入域成功后,你会收到一个关于 DNS 域名配置的警告:

"Changing the Primary Domain DNS name of this computer to "" failed.
The name will remain
"MYDOM". The error was:

The specified domain either does not exist or could not be contacted
"
可以忽略这个警告或者通过设置其他注册表条目来调整。

从如下位置获得 Windows 的修复脚本:  http://support.microsoft.com/kb/2171571

不要随意编辑 NETLOG 注册表的设置,确保他们是这样(见下文,有几个版本例外):

HKLM\System\CCS\Services\Netlogon\Parameters
DWORD RequireSignOrSeal
= 1
DWORD RequireStrongKey
= 1

关于 Samba 3.3.2, 3.3.3 and 3.3.4的说明

只有这些版本,你才需要调整 NETLOG 的参数:

HKLM\System\CCS\Services\Netlogon\Parameters
DWORD RequireSignOrSeal
= 0
DWORD RequireStrongKey
= 0

这样子之后,其实我这里好像还是有一点问题,主机系统是 Windows 7 Home preminum ,虚拟机是 Virtualbox ,安装操作系统 CentOS 5.5。不论使用
smbclient -L //192.168.56.1 还是 smbclient -L //192.168.56.1 -U tigertall ,都会报这个错误(192.168.56.1 是我Virtualbox HostOnly 网卡的地址):
[gaohu@tigertall ~]$ smbclient -L //192.168.56.1
Password:
Anonymous login successful
Domain
=[WORKGROUP] OS=[Windows 7 Home Premium 7601 Service Pack 1] Server=[Windows 7 Home Premium 6.1]

Sharename
Type Comment
--------- ---- -------
cli_rpc_pipe_open: cli_nt_create failed
on pipe \srvsvc to machine 192.168.56.1. Error was NT_STATUS_ACCESS_DENIED
Error returning browse list: NT_STATUS_ACCESS_DENIED
session request to
192.168.56.1 failed (Called name not present)
session request to
192 failed (Called name not present)
session request to *SMBSERVER failed
(Called name not present)
NetBIOS over TCP disabled -- no workgroup available

不知道是因为什么原因,给Windows的登陆用户设置了密码之后,还是会有个错误,
[gaohu@tigertall vim73]$ smbclient -L 192.168.56.1 -U tigertall
Password:
session setup failed: SUCCESS -
0
希望NB的哥哥给解释下。。。

抱着试一试的态度,偶然搞了一下挂载,竟然成功了

[gaohu@tigertall ~]$ sudo mount -t cifs -o username=tigertall //192.168.56.1/Tex src
Password: (直接回车,我没密码)
[gaohu@tigertall ~]
$ ls src
ls成功列出了挂载的目录,mygod....
因为是无密码的,而且给了 everyone 读写权限, 所以也可以直接使用 sudo mount -t cifs //192.168.56.1/Tex src 来挂载。。。密码同样输入空。。

其实,Virtualbox直接用它的文件夹共享也很好的,我自己贱。。。。

Windows 7 性能和时间注册表设置

这个不是必须的,网站上有人分享的。

他们能显著提高域登陆的速度并且允许在 Winows 7 专业版下使用 Samba 作为时间服务器:

echo 'Windows Registry Editor Version 5.00

; Win7_Samba3DomainMember
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanManWorkstation\Parameters]
"DNSNameResolutionRequired"=dword:00000000
"DomainCompatibilityMode"=dword:00000001

; Speedup settings
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System]
"SlowLinkDetectEnabled"=dword:00000000
"DeleteRoamingCache"=dword:00000001
"WaitForNetwork"=dword:00000000
"CompatibleRUPSecurity"=dword:00000001

; Can drive you nuts
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLUA"=dword:00000000' | tee Win7_Samba3DomainMember_jelledj.reg

unix2dos Win7_Samba3DomainMember_jelledj.reg

===

echo '@echo off
echo.
echo WARNING: Do not close this window!!!
echo.
c:\
"Program Files\Windows Resource Kits\Tools\ntrights.exe" +r SeSystemTimePrivilege -u "Domain Users"
echo.
echo WARNING: You may now close this window!!!
echo.' | tee SeSystemTimePrivilege_jelledj.bat

unix2dos SeSystemTimePrivilege_jelledj.bat

===

echo '@echo off
echo.
echo WARNING: Do not close this window!!!
echo.
"C:\Program Files\Mozilla Firefox\firefox.exe" http://download.microsoft.com/download/8/e/c/8ec3a7d8-05b4-440a-a71e-ca3ee25fe057/rktools.exe
echo.
echo WARNING: You may now close this window!!!
echo.' | tee rktools_jelledj.bat

unix2dos rktools_jelledj.bat

===

echo '@echo off
echo.
echo WARNING: Do not close this window!!!
echo.
NET USE Y: /DELETE
NET USE Y: \\server\documenten /PERSISTENT:YES
NET TIME \\server /SET /YES
echo.
echo WARNING: You may now close this window!!!
echo.' | tee /srv/storage/samba/netlogon/netlogon.bat

unix2dos /srv/storage/samba/netlogon/netlogon.bat

setfacl --recursive --modify u::rw
,g::r,m:---,o:--- /srv/storage/samba/netlogon/netlogon.bat
chmod g+r /srv/storage/samba/netlogon/netlogon.bat

cat /srv/storage/samba/netlogon/netlogon.bat
su -c
"cat /srv/storage/samba/netlogon/netlogon.bat" jelledj
posted on 2011-04-10 11:23  tigertall  阅读(11292)  评论(0编辑  收藏  举报