特殊:Badtitle/NS100:ActiveDirectoryWinbindHowto/zh:修订间差异
无编辑摘要 |
无编辑摘要 |
||
(未显示2个用户的4个中间版本) | |||
第1行: | 第1行: | ||
{{Copyedit translation|from=https://help.ubuntu.com/community/ActiveDirectoryWinbindHowto}} | |||
{{From|https://help.ubuntu.com/community/ActiveDirectoryWinbindHowto}} | |||
{{Translator|xiaotian0127 jackphone}} | |||
{{Verifier|tlhl28 dbzhang800}} | |||
{{Languages|UbuntuHelp:ActiveDirectoryWinbindHowto}} | |||
这是一个关于怎样在一个Active Directory domain中增加一个ubuntu box并使用AD进行用户验证的介绍. | |||
=== 软件环境 === | === 软件环境 === | ||
第39行: | 第43行: | ||
|- | |- | ||
| AD | | AD | ||
| | | 活动目录(Active Directory) | ||
|- | |- | ||
| DC | | DC | ||
| | | 域控制器(Domain Controller) | ||
|- | |- | ||
| lab.example.com | | lab.example.com | ||
第57行: | 第61行: | ||
|- | |- | ||
| linuxwork | | linuxwork | ||
| | | Ubuntu工作站的计算机名 | ||
|- | |- | ||
| linuxwork.lab.example.com | | linuxwork.lab.example.com | ||
| | | Ubuntu工作站的完整域名 | ||
|- | |- | ||
| ntp.example.com | | ntp.example.com | ||
第66行: | 第70行: | ||
|} | |} | ||
=== 确认连接畅通 | === 确认连接畅通 === | ||
=== | 配置活动目录(AD)所在网络的Ubuntu客户端的第一步是确保网络的畅通和ActiveDirectory的域控制器的名字解析无误. 可以用一个简单的方法来验证这两点,那就是ping你的网络上的活动目录的域控制器的完整域名(FQDN)。 | ||
root@linuxwork:~# ping win2k3.lab.example.com | |||
PING win2k3.lab.example.com (10.0.0.1) 56(84) bytes of data. | |||
64 bytes from win2k3.lab.example.com (10.0.0.1): icmp_seq=1 ttl=128 time=0.176ms | |||
ping的输出显示FQDN已经被成功的解析为一个IP地址了,并且您ubuntu工作站和AD DC之间的连接已经畅通。 | |||
时间设置 | === 时间设置 === | ||
时间对于kerberos是必不可少的,他用于ActiveDirectory网络中的认证. 最简单的方法是使用一个NTP服务器来确保时间的正确同步 每一个活动目录域控制器同时也是一个NTP服务器,为了达到最佳效果,在Ubuntu默认的ntpdate应用中使用AD DC的完整域名,他将在开机时或者按指定的要求来同步时间。 | 时间对于kerberos是必不可少的,他用于ActiveDirectory网络中的认证. 最简单的方法是使用一个NTP服务器来确保时间的正确同步 每一个活动目录域控制器同时也是一个NTP服务器,为了达到最佳效果,在Ubuntu默认的ntpdate应用中使用AD DC的完整域名,他将在开机时或者按指定的要求来同步时间。 | ||
file: <code><nowiki>/etc/default/ntpdate</nowiki></code> | file: <code><nowiki>/etc/default/ntpdate</nowiki></code> | ||
# servers to check | |||
NTPSERVERS="win2k3.lab.example.com" | NTPSERVERS="win2k3.lab.example.com" | ||
# additional options for ntpdate | # additional options for ntpdate | ||
NTPOPTIONS="-u" | NTPOPTIONS="-u" | ||
root@linuxwork:~# /etc/init.d/ntpdate restart | |||
Synchronizing clock to win2k3.lab.example.com... [ ok ] | |||
=== 正式完整域名(FQDN) === | |||
=== | |||
对于Kerberos和活动目录来说,一个有效的FQDN是必不可少的 活动目录非常依赖于DNS,因此很可能您的ActiveDirectory域控制器也在运行着Microsoft的DNS服务器组件. 在这里,我们将在您的ubuntu工作站上编辑本地hosts文件,以确保您的域名是可以解析的. | 对于Kerberos和活动目录来说,一个有效的FQDN是必不可少的 活动目录非常依赖于DNS,因此很可能您的ActiveDirectory域控制器也在运行着Microsoft的DNS服务器组件. 在这里,我们将在您的ubuntu工作站上编辑本地hosts文件,以确保您的域名是可以解析的. | ||
file: <code><nowiki>/etc/hosts</nowiki></code> | file: <code><nowiki>/etc/hosts</nowiki></code> | ||
127.0.0.1 linuxwork.lab.example.com localhost linuxwork | |||
您也可以通过ping您自己的完整域名来测试您的配置 输出的结果应该类似于上面的ping输出的结果,在网络中连线测试(当然, 这个域名将是您自己,而IP地址,将将是127.0.0.1). | 您也可以通过ping您自己的完整域名来测试您的配置 输出的结果应该类似于上面的ping输出的结果,在网络中连线测试(当然, 这个域名将是您自己,而IP地址,将将是127.0.0.1). | ||
=== | === 建立Kerberos === | ||
设置Kerberos的第一步是要安装适当的客户端软件. 这个过程假设你已经在你的sources.list以及Univers repository中打开了所有breezy的main和security源. | 设置Kerberos的第一步是要安装适当的客户端软件. 这个过程假设你已经在你的sources.list以及Univers repository中打开了所有breezy的main和security源. | ||
==== 需要的软件 | ==== 需要的软件 ==== | ||
恰当的安装必需的Kerberos软件包,您需要下列的apt-get命令来安装软件: | 恰当的安装必需的Kerberos软件包,您需要下列的apt-get命令来安装软件: | ||
root@linuxwork:~# apt-get install krb5-user libpam-krb5 | |||
对于''krb5-user'' 您将需要''universe'' repository. | 对于''krb5-user'' 您将需要''universe'' repository. | ||
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png | https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png | ||
如果你不打算在登录时要求Kerberos ticket,你不用安装libpam-krb5软件包. | 如果你不打算在登录时要求Kerberos ticket,你不用安装libpam-krb5软件包. | ||
该命令还将去取得附加软件包krb5-config,libkrb53,libkadm55。 | 该命令还将去取得附加软件包krb5-config,libkrb53,libkadm55。 | ||
该krb5-config安装将会提示: | 该krb5-config安装将会提示: | ||
What are the Kerberos servers for your realm? | |||
win2k3.lab.example.com | win2k3.lab.example.com | ||
What is the administrative server for your Kerberos realm? | What is the administrative server for your Kerberos realm? | ||
win2k3.lab.example.com | win2k3.lab.example.com | ||
这些提示应该根据您负责的域的ActiveDirectory的域控制器来回答. 该krb5-config程序将定制<code><nowiki>/etc/krb5.conf</nowiki></code>文件以供安装使用. 在大多数情况下, 这个配置文件将正常工作, 但是,如果你想要一个更精简的配置文件 (例如, without all the Kerberos 4 cruft), 您可以使用下列模板: | 这些提示应该根据您负责的域的ActiveDirectory的域控制器来回答. 该krb5-config程序将定制<code><nowiki>/etc/krb5.conf</nowiki></code>文件以供安装使用. 在大多数情况下, 这个配置文件将正常工作, 但是,如果你想要一个更精简的配置文件 (例如, without all the Kerberos 4 cruft), 您可以使用下列模板: | ||
file: <code><nowiki>/etc/krb5.conf</nowiki></code> | file: <code><nowiki>/etc/krb5.conf</nowiki></code> | ||
<pre>[logging] | <pre>[logging] | ||
default = FILE:/var/log/krb5.log | default = FILE:/var/log/krb5.log | ||
第183行: | 第148行: | ||
lab.example.com = LAB.EXAMPLE.COM | lab.example.com = LAB.EXAMPLE.COM | ||
</pre> | </pre> | ||
注意这两个"dns"指令已经被注释掉. 你可以选择使用dns寻找kerberos realm服务器 或者你可以选择使用<code><nowiki>krb5.conf</nowiki></code>文件来定义kerberos realm的服务器. 如果你选择使用DNS, 取消上面的两行注释而代之以在<code><nowiki>[realms]</nowiki></code>标题下注释或移除完整的指令. | 注意这两个"dns"指令已经被注释掉. 你可以选择使用dns寻找kerberos realm服务器 或者你可以选择使用<code><nowiki>krb5.conf</nowiki></code>文件来定义kerberos realm的服务器. 如果你选择使用DNS, 取消上面的两行注释而代之以在<code><nowiki>[realms]</nowiki></code>标题下注释或移除完整的指令. | ||
'''测试''' | '''测试''' | ||
通过发出<code><nowiki>kinit</nowiki></code>命令来获得Ticket-Granting Ticket (TGT),如上所示(你可以使用任何有效域帐户; 它不必是管理员. 你也可以在命令中省略域名,如果"default_realm"指令在 <code><nowiki>/etc/krb5.conf</nowiki></code> 文件中被妥善应用的话. | 通过发出<code><nowiki>kinit</nowiki></code>命令来获得Ticket-Granting Ticket (TGT),如上所示(你可以使用任何有效域帐户; 它不必是管理员. 你也可以在命令中省略域名,如果"default_realm"指令在 <code><nowiki>/etc/krb5.conf</nowiki></code> 文件中被妥善应用的话. | ||
root@linuxwork:~# kinit [email protected] | |||
Password for [email protected]: **** | Password for [email protected]: **** | ||
使用 <code><nowiki>klist</nowiki></code> 命令检查一下ticket是否有效. | 使用 <code><nowiki>klist</nowiki></code> 命令检查一下ticket是否有效. | ||
第207行: | 第165行: | ||
renew until 01/21/05 20:28:51 | renew until 01/21/05 20:28:51 | ||
</pre> | </pre> | ||
此时,你的Kerberos已经被正确的安装和配置,你可以使用 <code><nowiki>kdestroy</nowiki></code> 命令来释放你的测试ticket. | 此时,你的Kerberos已经被正确的安装和配置,你可以使用 <code><nowiki>kdestroy</nowiki></code> 命令来释放你的测试ticket. | ||
=== | === 加入AD域=== | ||
==== 需要的软件 ==== | |||
==== 需要的软件 | |||
需要的软件 Windows 2003 Server SP1 Winbind version 3.0.14a是必需的。在Hoary中仅有 3.0.10版,但是在Breezy中你能找到3.0.14a。 | 需要的软件 Windows 2003 Server SP1 Winbind version 3.0.14a是必需的。在Hoary中仅有 3.0.10版,但是在Breezy中你能找到3.0.14a。 | ||
<pre>root@linuxwork:~# apt-get install winbind samba [smbfs smbclient] | <pre>root@linuxwork:~# apt-get install winbind samba [smbfs smbclient] | ||
</pre> | </pre> | ||
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png | https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png | ||
软件包"smbfs"是可选的,但是他包含了许多有用的客户端工具,包括"smbmount"命令. "smbclient"软件包也是有用的,其中包括为SMB共享建立一个类ftp客户端. | 软件包"smbfs"是可选的,但是他包含了许多有用的客户端工具,包括"smbmount"命令. "smbclient"软件包也是有用的,其中包括为SMB共享建立一个类ftp客户端. | ||
==== | ==== 加入 ==== | ||
file: <code><nowiki>/etc/samba/smb.conf</nowiki></code> | file: <code><nowiki>/etc/samba/smb.conf</nowiki></code> | ||
第249行: | 第200行: | ||
restrict anonymous = 2 | restrict anonymous = 2 | ||
</pre> | </pre> | ||
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png | https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png | ||
"winbind use default domain"参数在单域环境中是非常有用的,使winbind采取所有用户应当在域中进行认证来决定哪一个winbind加入. 如果您的环境包含多个域或假如你的帐户域与资源域不同,请省略这个参数. "winbind separator"选项是可选的,默认值是通常的反斜线"\"域和用户分隔符. 你可以使用"+"号,如果在您的环境因为某个特定原因"\"不能用的话 | "winbind use default domain"参数在单域环境中是非常有用的,使winbind采取所有用户应当在域中进行认证来决定哪一个winbind加入. 如果您的环境包含多个域或假如你的帐户域与资源域不同,请省略这个参数. "winbind separator"选项是可选的,默认值是通常的反斜线"\"域和用户分隔符. 你可以使用"+"号,如果在您的环境因为某个特定原因"\"不能用的话 | ||
在修改 <code><nowiki>/etc/samba/smb.conf</nowiki></code>文件后,需要重启samba和winbind服务: | |||
root@linuxwork:~# /etc/init.d/winbind stop | |||
root@linuxwork:~# /etc/init.d/samba restart | |||
root@linuxwork:~# /etc/init.d/samba restart | root@linuxwork:~# /etc/init.d/winbind start | ||
root@linuxwork:~# /etc/init.d/winbind start | |||
一个帐号要求,要增加一个工作站到AD域需要一个帐号,该帐号要求有效的Kerberos TGT. | 一个帐号要求,要增加一个工作站到AD域需要一个帐号,该帐号要求有效的Kerberos TGT. | ||
如果Kerberos认证是有效的, 你不应当为密码设置问题。但是, 如果你不能以root用户工作,那么你将使用sudo命令来完成必要的任务,使用命令 <code><nowiki>sudo net ads join -U username</nowiki></code> | root@linuxwork:~# net ads join | ||
Using short domain name – LAB | |||
Joined 'linuxwork' to realm 'LAB.EXAMPLE.COM' | |||
如果Kerberos认证是有效的, 你不应当为密码设置问题。但是, 如果你不能以root用户工作,那么你将使用sudo命令来完成必要的任务,使用命令 <code><nowiki>sudo net ads join -U username</nowiki></code> ,当提示要求时输入您的密码。否则, 你会被要求作为[email protected]进行认证 ,以代替一个有效的帐号名. | |||
==== | ==== 测试==== | ||
# wbinfo -u | |||
你会得到一个域用户列表。 | 你会得到一个域用户列表。 | ||
# wbinfo -g | |||
=== 设置认证(Setup Authentication) === | === 设置认证(Setup Authentication) === | ||
第288行: | 第231行: | ||
file: <code><nowiki>/etc/nsswitch.conf</nowiki></code> | file: <code><nowiki>/etc/nsswitch.conf</nowiki></code> | ||
passwd: compat winbind | |||
group: compat winbind | group: compat winbind | ||
shadow: compat | shadow: compat | ||
==== Testing ==== | ==== Testing ==== | ||
Check Winbind nsswitch module with '''getent'''. | |||
<pre><nowiki> | |||
root@linuxwork:~# getent passwd | |||
root:x:0:0:root:/root:/bin/bash | root:x:0:0:root:/root:/bin/bash | ||
... | ... | ||
第301行: | 第245行: | ||
LAB+gast:x:10001:10001:Gast:/home/LAB/gast:/bin/bash | LAB+gast:x:10001:10001:Gast:/home/LAB/gast:/bin/bash | ||
... | ... | ||
</pre> <pre>root@linuxwork:~# getent group | </nowiki></pre> | ||
<pre><nowiki> | |||
root@linuxwork:~# getent group | |||
root:x:0: | |||
daemon:x:1: | daemon:x:1: | ||
bin:x:2: | bin:x:2: | ||
第313行: | 第259行: | ||
LAB+linux-admins:x:10004:manuel | LAB+linux-admins:x:10004:manuel | ||
... | ... | ||
</nowiki></pre> | |||
</pre> | |||
==== PAM ==== | ==== PAM ==== | ||
这个配置下,你可以利用本地用户或域用户访问工作站 域用户第一次登录时会创建一个home目录. 这个PAM配置假定这个系统将主要用于域帐户. 如果相反(即,该系统将主要用于本地用户), 当使用本地用户时,pam_winbind.so和pam_unix.so顺序应当翻转. 这儿显示的配置将导致登录时和使用sudo时Windows/samba DC认证失败. 这样可能丢失DC的事件日志 同样的,如果先检查本地帐户, 每次当一个域帐户被访问,/var/log/auth.log将满布失败的登录尝试. | 这个配置下,你可以利用本地用户或域用户访问工作站 域用户第一次登录时会创建一个home目录. 这个PAM配置假定这个系统将主要用于域帐户. 如果相反(即,该系统将主要用于本地用户), 当使用本地用户时,pam_winbind.so和pam_unix.so顺序应当翻转. 这儿显示的配置将导致登录时和使用sudo时Windows/samba DC认证失败. 这样可能丢失DC的事件日志 同样的,如果先检查本地帐户, 每次当一个域帐户被访问,/var/log/auth.log将满布失败的登录尝试. | ||
登录时这个PAM配置不需要Kerberos TGT. 需要ticket,登录后使用kinit,并考虑在登出脚本内使用"kdestroy". | |||
登录时这个PAM配置不需要Kerberos TGT. 需要ticket, | |||
file: <code><nowiki>/etc/pam.d/common-account</nowiki></code> | file: <code><nowiki>/etc/pam.d/common-account</nowiki></code> | ||
第355行: | 第285行: | ||
@include common-account | @include common-account | ||
</pre> | </pre> | ||
=== 最终的配置 | === 最终的配置 === | ||
每个域在/home/中需要一个目录 | 每个域在/home/中需要一个目录 | ||
root@linuxwork:~# mkdir /home/LAB | |||
=== 最後一件事 === | |||
如果你想能够通过管理你的ubuntu box使用一个活动目录帐号,你需要把他加到 sudoers文件中。因此,你需要编辑 /etc/group文件并且加入你的用户名到admin(管理员)组中和任何你需要加入的 | 如果你想能够通过管理你的ubuntu box使用一个活动目录帐号,你需要把他加到 sudoers文件中。因此,你需要编辑 /etc/group文件并且加入你的用户名到admin(管理员)组中和任何你需要加入的 用户组(提示一下,比如plugdev,audio,cdrom)。将会像这样: | ||
<pre>....... | <pre>....... | ||
admin:x:117:olduser,ActiveDirectoryUser | admin:x:117:olduser,ActiveDirectoryUser | ||
.......</pre> | .......</pre> | ||
那里的olduser就是你当前的linux用户而ActiveDirectoryUser就是'%Domain\ admins'新的管理员用户。另一个创建域组(你的ubuntu里的一个sudoer)的方法是编辑文件 /etc/sudoers(使用指令'visudo‘)然後加入一下行: | 那里的olduser就是你当前的linux用户而ActiveDirectoryUser就是'%Domain\ admins'新的管理员用户。另一个创建域组(你的ubuntu里的一个sudoer)的方法是编辑文件 /etc/sudoers(使用指令'visudo‘)然後加入一下行: | ||
%adgroup ALL=(ALL) ALL | |||
那里的adgroup就是一个你的活动目录里的组。清注意,组的名字里不能有空格,也许你可以用'%Domain\ admins',但我还没测试过。 | 那里的adgroup就是一个你的活动目录里的组。清注意,组的名字里不能有空格,也许你可以用'%Domain\ admins',但我还没测试过。 | ||
=== 用法 === | === 用法 === | ||
使用“域+用户名”登录,除非你在smb.conf中设定了"winbind use default domain"(winbind使用默认网域名称),那样的话,你可以直接用“用户名”登录。 | 使用“域+用户名”登录,除非你在smb.conf中设定了"winbind use default domain"(winbind使用默认网域名称),那样的话,你可以直接用“用户名”登录。 | ||
第388行: | 第310行: | ||
LAB+manuel@linuxwork:~$ | LAB+manuel@linuxwork:~$ | ||
</pre> | </pre> | ||
=== 自动Kerberos认证书 | === 自动Kerberos认证书=== | ||
在smb.conf : file: /etc/samba/smb.conf 里添加winbind自动刷新认证的行,使pam_winbind 自动的刷新kerberos认证书。 | |||
<pre># winbind separator = + | <pre># winbind separator = + | ||
winbind refresh tickets = yes | winbind refresh tickets = yes | ||
idmap uid = 10000-20000</pre> | idmap uid = 10000-20000</pre> | ||
还要修改 /etc/pam.d/common-auth:file:/etc/pam.d/common-auth如下: | 还要修改 /etc/pam.d/common-auth:file:/etc/pam.d/common-auth如下: | ||
第403行: | 第324行: | ||
=== 疑难解答 === | === 疑难解答 === | ||
如果 <code><nowiki>/var/log/auth.log</nowiki></code> 文件中的Winbind PAM模块显示, 该AD用户不存在的,重启winbind. 可能重新启动整个工作站是最好的方式. | 如果 <code><nowiki>/var/log/auth.log</nowiki></code> 文件中的Winbind PAM模块显示, 该AD用户不存在的,重启winbind. 可能重新启动整个工作站是最好的方式. | ||
第410行: | 第329行: | ||
</pre> | </pre> | ||
==== 其他文档(External Docs) ==== | ==== 其他文档(External Docs) ==== | ||
另见在 randompage.org上的 [http://wiki.randompage.org/index.php/Using_Samba_on_Debian_Linux_to_authenticate_against_Active_Directory Using Samba on Debian Linux to authenticate against Active Directory] . 除了一点细节外,它在很大程度上与这页相似. | 另见在 randompage.org上的 [http://wiki.randompage.org/index.php/Using_Samba_on_Debian_Linux_to_authenticate_against_Active_Directory Using Samba on Debian Linux to authenticate against Active Directory] . 除了一点细节外,它在很大程度上与这页相似. | ||
[[category:CategorySecurity]] | |||
[[category:UbuntuHelp]] |
2008年4月17日 (四) 16:16的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/ActiveDirectoryWinbindHowto }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/af | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|Afrikaans| [[::ActiveDirectoryWinbindHowto/zh/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/ar | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|العربية| [[::ActiveDirectoryWinbindHowto/zh/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/az | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|azərbaycanca| [[::ActiveDirectoryWinbindHowto/zh/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/bcc | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|جهلسری بلوچی| [[::ActiveDirectoryWinbindHowto/zh/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/bg | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|български| [[::ActiveDirectoryWinbindHowto/zh/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/br | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|brezhoneg| [[::ActiveDirectoryWinbindHowto/zh/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/ca | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|català| [[::ActiveDirectoryWinbindHowto/zh/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/cs | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|čeština| [[::ActiveDirectoryWinbindHowto/zh/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/de | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|Deutsch| [[::ActiveDirectoryWinbindHowto/zh/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/el | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|Ελληνικά| [[::ActiveDirectoryWinbindHowto/zh/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/es | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|español| [[::ActiveDirectoryWinbindHowto/zh/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/fa | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|فارسی| [[::ActiveDirectoryWinbindHowto/zh/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/fi | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|suomi| [[::ActiveDirectoryWinbindHowto/zh/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/fr | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|français| [[::ActiveDirectoryWinbindHowto/zh/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/gu | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|ગુજરાતી| [[::ActiveDirectoryWinbindHowto/zh/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/he | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|עברית| [[::ActiveDirectoryWinbindHowto/zh/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/hu | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|magyar| [[::ActiveDirectoryWinbindHowto/zh/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/id | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|Bahasa Indonesia| [[::ActiveDirectoryWinbindHowto/zh/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/it | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|italiano| [[::ActiveDirectoryWinbindHowto/zh/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/ja | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|日本語| [[::ActiveDirectoryWinbindHowto/zh/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/ko | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|한국어| [[::ActiveDirectoryWinbindHowto/zh/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/ksh | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|Ripoarisch| [[::ActiveDirectoryWinbindHowto/zh/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/mr | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|मराठी| [[::ActiveDirectoryWinbindHowto/zh/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/ms | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|Bahasa Melayu| [[::ActiveDirectoryWinbindHowto/zh/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/nl | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|Nederlands| [[::ActiveDirectoryWinbindHowto/zh/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/no | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|norsk| [[::ActiveDirectoryWinbindHowto/zh/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/oc | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|occitan| [[::ActiveDirectoryWinbindHowto/zh/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/pl | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|polski| [[::ActiveDirectoryWinbindHowto/zh/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/pt | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|português| [[::ActiveDirectoryWinbindHowto/zh/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/ro | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|română| [[::ActiveDirectoryWinbindHowto/zh/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/ru | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|русский| [[::ActiveDirectoryWinbindHowto/zh/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/si | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|සිංහල| [[::ActiveDirectoryWinbindHowto/zh/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/sq | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|shqip| [[::ActiveDirectoryWinbindHowto/zh/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/sr | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|српски / srpski| [[::ActiveDirectoryWinbindHowto/zh/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/sv | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|svenska| [[::ActiveDirectoryWinbindHowto/zh/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/th | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|ไทย| [[::ActiveDirectoryWinbindHowto/zh/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/tr | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|Türkçe| [[::ActiveDirectoryWinbindHowto/zh/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/vi | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|Tiếng Việt| [[::ActiveDirectoryWinbindHowto/zh/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/yue | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|粵語| [[::ActiveDirectoryWinbindHowto/zh/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/zh | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|中文| [[::ActiveDirectoryWinbindHowto/zh/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/zh-hans | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|中文(简体)| [[::ActiveDirectoryWinbindHowto/zh/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto | UbuntuHelp:ActiveDirectoryWinbindHowto | {{#if: | :}}ActiveDirectoryWinbindHowto/zh}}/zh-hant | • {{#if: UbuntuHelp:ActiveDirectoryWinbindHowto|中文(繁體)| [[::ActiveDirectoryWinbindHowto/zh/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:ActiveDirectoryWinbindHowto|:ActiveDirectoryWinbindHowto/zh|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :ActiveDirectoryWinbindHowto/zh/zh | | {{#ifexist: ActiveDirectoryWinbindHowto/zh/zh | | {{#ifeq: {{#titleparts:ActiveDirectoryWinbindHowto/zh|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:ActiveDirectoryWinbindHowto/zh|1|-1|}} | zh | | }}
这是一个关于怎样在一个Active Directory domain中增加一个ubuntu box并使用AD进行用户验证的介绍.
软件环境
名称 | 版本 |
MS Windows Server | 2003 standard sp1 |
Linux | Ubuntu Breezy 5.10 |
Winbind | 3.0.14a-Ubuntu |
Samba | 3.0.14a-Ubuntu |
krb5-user | 1.3.6-1 |
libpam-krb5 | 1.0-12 |
Used terms
term | definition |
AD | 活动目录(Active Directory) |
DC | 域控制器(Domain Controller) |
lab.example.com | AD domain |
win2k3.lab.example.com | DC FQDN |
10.0.0.1 | DC IP |
LAB.EXAMPLE.COM | Kerberos Realm |
linuxwork | Ubuntu工作站的计算机名 |
linuxwork.lab.example.com | Ubuntu工作站的完整域名 |
ntp.example.com | timeserver (NTP) |
确认连接畅通
配置活动目录(AD)所在网络的Ubuntu客户端的第一步是确保网络的畅通和ActiveDirectory的域控制器的名字解析无误. 可以用一个简单的方法来验证这两点,那就是ping你的网络上的活动目录的域控制器的完整域名(FQDN)。
root@linuxwork:~# ping win2k3.lab.example.com PING win2k3.lab.example.com (10.0.0.1) 56(84) bytes of data. 64 bytes from win2k3.lab.example.com (10.0.0.1): icmp_seq=1 ttl=128 time=0.176ms
ping的输出显示FQDN已经被成功的解析为一个IP地址了,并且您ubuntu工作站和AD DC之间的连接已经畅通。
时间设置
时间对于kerberos是必不可少的,他用于ActiveDirectory网络中的认证. 最简单的方法是使用一个NTP服务器来确保时间的正确同步 每一个活动目录域控制器同时也是一个NTP服务器,为了达到最佳效果,在Ubuntu默认的ntpdate应用中使用AD DC的完整域名,他将在开机时或者按指定的要求来同步时间。
file: /etc/default/ntpdate
# servers to check NTPSERVERS="win2k3.lab.example.com" # additional options for ntpdate NTPOPTIONS="-u"
root@linuxwork:~# /etc/init.d/ntpdate restart Synchronizing clock to win2k3.lab.example.com... [ ok ]
正式完整域名(FQDN)
对于Kerberos和活动目录来说,一个有效的FQDN是必不可少的 活动目录非常依赖于DNS,因此很可能您的ActiveDirectory域控制器也在运行着Microsoft的DNS服务器组件. 在这里,我们将在您的ubuntu工作站上编辑本地hosts文件,以确保您的域名是可以解析的.
file: /etc/hosts
127.0.0.1 linuxwork.lab.example.com localhost linuxwork
您也可以通过ping您自己的完整域名来测试您的配置 输出的结果应该类似于上面的ping输出的结果,在网络中连线测试(当然, 这个域名将是您自己,而IP地址,将将是127.0.0.1).
建立Kerberos
设置Kerberos的第一步是要安装适当的客户端软件. 这个过程假设你已经在你的sources.list以及Univers repository中打开了所有breezy的main和security源.
需要的软件
恰当的安装必需的Kerberos软件包,您需要下列的apt-get命令来安装软件:
root@linuxwork:~# apt-get install krb5-user libpam-krb5
对于krb5-user 您将需要universe repository.
如果你不打算在登录时要求Kerberos ticket,你不用安装libpam-krb5软件包.
该命令还将去取得附加软件包krb5-config,libkrb53,libkadm55。
该krb5-config安装将会提示:
What are the Kerberos servers for your realm? win2k3.lab.example.com What is the administrative server for your Kerberos realm? win2k3.lab.example.com
这些提示应该根据您负责的域的ActiveDirectory的域控制器来回答. 该krb5-config程序将定制/etc/krb5.conf
文件以供安装使用. 在大多数情况下, 这个配置文件将正常工作, 但是,如果你想要一个更精简的配置文件 (例如, without all the Kerberos 4 cruft), 您可以使用下列模板:
file: /etc/krb5.conf
[logging] default = FILE:/var/log/krb5.log [libdefaults] ticket_lifetime = 24000 clock_skew = 300 default_realm = LAB.EXAMPLE.COM # dns_lookup_realm = false # dns_lookup_kdc = true [realms] LAB.EXAMPLE.COM = { kdc = win2k3.lab.example.com:88 admin_server = win2k3.lab.example.com:464 default_domain = LAB.EXAMPLE.COM } [domain_realm] .lab.example.com = LAB.EXAMPLE.COM lab.example.com = LAB.EXAMPLE.COM
注意这两个"dns"指令已经被注释掉. 你可以选择使用dns寻找kerberos realm服务器 或者你可以选择使用krb5.conf
文件来定义kerberos realm的服务器. 如果你选择使用DNS, 取消上面的两行注释而代之以在[realms]
标题下注释或移除完整的指令.
测试
通过发出kinit
命令来获得Ticket-Granting Ticket (TGT),如上所示(你可以使用任何有效域帐户; 它不必是管理员. 你也可以在命令中省略域名,如果"default_realm"指令在 /etc/krb5.conf
文件中被妥善应用的话.
root@linuxwork:~# kinit [email protected] Password for [email protected]: ****
使用 klist
命令检查一下ticket是否有效.
root@linuxwork:~# klist Ticket cache: FILE:/tmp/krb5cc_0 Default principal: [email protected] Valid starting Expires Service principal 01/21/05 10:28:51 01/21/05 20:27:43 krbtgt/[email protected] renew until 01/21/05 20:28:51
此时,你的Kerberos已经被正确的安装和配置,你可以使用 kdestroy
命令来释放你的测试ticket.
加入AD域
需要的软件
需要的软件 Windows 2003 Server SP1 Winbind version 3.0.14a是必需的。在Hoary中仅有 3.0.10版,但是在Breezy中你能找到3.0.14a。
root@linuxwork:~# apt-get install winbind samba [smbfs smbclient]
软件包"smbfs"是可选的,但是他包含了许多有用的客户端工具,包括"smbmount"命令. "smbclient"软件包也是有用的,其中包括为SMB共享建立一个类ftp客户端.
加入
file: /etc/samba/smb.conf
[global] security = ads realm = LAB.EXAMPLE.COM password server = 10.0.0.1 workgroup = LAB # winbind separator = + idmap uid = 10000-20000 idmap gid = 10000-20000 winbind enum users = yes winbind enum groups = yes template homedir = /home/%D/%U template shell = /bin/bash client use spnego = yes client use ntlmv2 = yes encrypt passwords = yes winbind use default domain = yes restrict anonymous = 2
"winbind use default domain"参数在单域环境中是非常有用的,使winbind采取所有用户应当在域中进行认证来决定哪一个winbind加入. 如果您的环境包含多个域或假如你的帐户域与资源域不同,请省略这个参数. "winbind separator"选项是可选的,默认值是通常的反斜线"\"域和用户分隔符. 你可以使用"+"号,如果在您的环境因为某个特定原因"\"不能用的话
在修改 /etc/samba/smb.conf
文件后,需要重启samba和winbind服务:
root@linuxwork:~# /etc/init.d/winbind stop root@linuxwork:~# /etc/init.d/samba restart root@linuxwork:~# /etc/init.d/winbind start
一个帐号要求,要增加一个工作站到AD域需要一个帐号,该帐号要求有效的Kerberos TGT.
root@linuxwork:~# net ads join Using short domain name – LAB Joined 'linuxwork' to realm 'LAB.EXAMPLE.COM'
如果Kerberos认证是有效的, 你不应当为密码设置问题。但是, 如果你不能以root用户工作,那么你将使用sudo命令来完成必要的任务,使用命令 sudo net ads join -U username
,当提示要求时输入您的密码。否则, 你会被要求作为[email protected]进行认证 ,以代替一个有效的帐号名.
测试
# wbinfo -u
你会得到一个域用户列表。
# wbinfo -g
设置认证(Setup Authentication)
nsswitch
file: /etc/nsswitch.conf
passwd: compat winbind group: compat winbind shadow: compat
Testing
Check Winbind nsswitch module with getent.
root@linuxwork:~# getent passwd root:x:0:0:root:/root:/bin/bash ... LAB+administrator:x:10000:10000:Administrator:/home/LAB/administrator:/bin/bash LAB+gast:x:10001:10001:Gast:/home/LAB/gast:/bin/bash ...
root@linuxwork:~# getent group root:x:0: daemon:x:1: bin:x:2: ... LAB+organisations-admins:x:10005:administrator LAB+domänen-admins:x:10006:manuel,administrator LAB+domänen-benutzer:x:10000: LAB+domänen-gäste:x:10001: LAB+linux-admins:x:10004:manuel ...
PAM
这个配置下,你可以利用本地用户或域用户访问工作站 域用户第一次登录时会创建一个home目录. 这个PAM配置假定这个系统将主要用于域帐户. 如果相反(即,该系统将主要用于本地用户), 当使用本地用户时,pam_winbind.so和pam_unix.so顺序应当翻转. 这儿显示的配置将导致登录时和使用sudo时Windows/samba DC认证失败. 这样可能丢失DC的事件日志 同样的,如果先检查本地帐户, 每次当一个域帐户被访问,/var/log/auth.log将满布失败的登录尝试.
登录时这个PAM配置不需要Kerberos TGT. 需要ticket,登录后使用kinit,并考虑在登出脚本内使用"kdestroy".
file: /etc/pam.d/common-account
account sufficient pam_winbind.so account required pam_unix.so
file: /etc/pam.d/common-auth
auth sufficient pam_winbind.so auth sufficient pam_unix.so nullok_secure use_first_pass auth required pam_deny.so
file: /etc/pam.d/common-session
session required pam_unix.so session required pam_mkhomedir.so umask=0022 skel=/etc/skel
file: /etc/pam.d/sudo
auth sufficient pam_winbind.so auth sufficient pam_unix.so use_first_pass auth required pam_deny.so @include common-account
最终的配置
每个域在/home/中需要一个目录
root@linuxwork:~# mkdir /home/LAB
最後一件事
如果你想能够通过管理你的ubuntu box使用一个活动目录帐号,你需要把他加到 sudoers文件中。因此,你需要编辑 /etc/group文件并且加入你的用户名到admin(管理员)组中和任何你需要加入的 用户组(提示一下,比如plugdev,audio,cdrom)。将会像这样:
....... admin:x:117:olduser,ActiveDirectoryUser .......
那里的olduser就是你当前的linux用户而ActiveDirectoryUser就是'%Domain\ admins'新的管理员用户。另一个创建域组(你的ubuntu里的一个sudoer)的方法是编辑文件 /etc/sudoers(使用指令'visudo‘)然後加入一下行:
%adgroup ALL=(ALL) ALL
那里的adgroup就是一个你的活动目录里的组。清注意,组的名字里不能有空格,也许你可以用'%Domain\ admins',但我还没测试过。
用法
使用“域+用户名”登录,除非你在smb.conf中设定了"winbind use default domain"(winbind使用默认网域名称),那样的话,你可以直接用“用户名”登录。
login: LAB+manuel Password: ***** ... LAB+manuel@linuxwork:~$
自动Kerberos认证书
在smb.conf : file: /etc/samba/smb.conf 里添加winbind自动刷新认证的行,使pam_winbind 自动的刷新kerberos认证书。
# winbind separator = + winbind refresh tickets = yes idmap uid = 10000-20000
还要修改 /etc/pam.d/common-auth:file:/etc/pam.d/common-auth如下:
auth sufficient pam_winbind.so krb5_auth krb5_ccache_type=FILE auth sufficient pam_unix.so nullok_secure use_first_pass auth required pam_deny.so
疑难解答
如果 /var/log/auth.log
文件中的Winbind PAM模块显示, 该AD用户不存在的,重启winbind. 可能重新启动整个工作站是最好的方式.
root@linuxwork:~# /etc/init.d/winbind start
其他文档(External Docs)
另见在 randompage.org上的 Using Samba on Debian Linux to authenticate against Active Directory . 除了一点细节外,它在很大程度上与这页相似.