特殊:Badtitle/NS100:AutofsLDAP/zh:修订间差异
无编辑摘要 |
|||
(未显示同一用户的9个中间版本) | |||
第1行: | 第1行: | ||
{{ | {{Copyedit translation}} | ||
{{From|https://help.ubuntu.com/community/AutofsLDAP}} | {{From|https://help.ubuntu.com/community/AutofsLDAP}} | ||
{{Translator|kmeng}} | {{Translator|kmeng}} | ||
第8行: | 第8行: | ||
== 安装 == | == 安装 == | ||
首先,automount 由内核模块和用户界面工具这两部分组成。比较新的GNU/Linux发布版已经把automount编译进内核。你只要安装用户界面工具就可以了。需要安装的用户工具包括:<code><nowiki>autofs-ldap ldap-utils</nowiki></code> (参照 [[UbuntuHelp:InstallingSoftware|InstallingSoftware]]). | 首先,automount 由内核模块和用户界面工具这两部分组成。比较新的GNU/Linux发布版已经把automount编译进内核。你只要安装用户界面工具就可以了。需要安装的用户工具包括:<code><nowiki>autofs-ldap ldap-utils</nowiki></code> (参照 [[UbuntuHelp:InstallingSoftware|InstallingSoftware]]). | ||
如果你只希望使用普通的配置文件,就不需要安装<code><nowiki>autofs-ldap </nowiki></code>。[[UbuntuHelp:Autofs|Autofs]] | 如果你只希望使用普通的配置文件,就不需要安装 <code><nowiki>autofs-ldap </nowiki></code>。[[UbuntuHelp:Autofs|Autofs]] 介绍了安装过程. | ||
== | == 配置 == | ||
LDAP 自动挂载的配置有下面几部分组成: | |||
* | * 配置 openldap 服务器,从而加载 autofs-ldap 模式 | ||
* | * 进入 LDAP 目录来定义挂载点 | ||
* | * 进入 LDAP 记录来定义目录 | ||
* | * 定义客户端使用 LDAP 的配置进行自动挂载 | ||
=== | === 服务器(server)端 === | ||
打开并修改 slapd 配置文件,让 slapd 后台程序加载 ldap 模式:<code><nowiki>/etc/ldap/schema/autofs-ldap.schema</nowiki></code>: | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo nano /etc/ldap/slapd.conf | sudo nano /etc/ldap/slapd.conf | ||
</nowiki></pre> | </nowiki></pre> | ||
在<code><nowiki>core.schema</nowiki></code> 和 <code><nowiki>cosine.schema</nowiki></code> 之后加入下面2行: | |||
<pre><nowiki> | <pre><nowiki> | ||
#Schema and objectClass definitions | #Schema and objectClass definitions | ||
include /etc/ldap/schema/autofs.schema | include /etc/ldap/schema/autofs.schema | ||
</nowiki></pre> | </nowiki></pre> | ||
最后重启 slapd 服务: | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo /etc/init.d/slapd restart | sudo /etc/init.d/slapd restart | ||
</nowiki></pre> | </nowiki></pre> | ||
=== | |||
=== 组装 LDAP === | |||
* | 在 LDAP 目录里, 你必须进入这两种记录: | ||
* | * 定义挂载点的记录 | ||
* 定义挂载点下目录的记录 | |||
下面是一个基于 [[UbuntuHelp:OpenLDAPServer|OpenLDAPServer]] 安装的记录: | |||
<pre><nowiki> | <pre><nowiki> | ||
dn: ou=admin,dc=example,dc=com | dn: ou=admin,dc=example,dc=com | ||
第64行: | 第64行: | ||
automountInformation: -fstype=nfs,rw,hard,intr,nodev,exec,nosuid,rsize=8192,wsize=8192 nfs.example.com:/export/home/lionel | automountInformation: -fstype=nfs,rw,hard,intr,nodev,exec,nosuid,rsize=8192,wsize=8192 nfs.example.com:/export/home/lionel | ||
</nowiki></pre> | </nowiki></pre> | ||
=== | |||
=== 用户端 === | |||
在用户端你只需要把 LDAP 的映射添加到挂载点的记录 <code><nowiki>/etc/nsswitch.conf</nowiki></code>. 打开 <code><nowiki>/etc/nsswitch.conf</nowiki></code> 文件并且加入下面一行: | |||
<pre><nowiki> | <pre><nowiki> | ||
automount: files ldap | automount: files ldap | ||
</nowiki></pre> | </nowiki></pre> | ||
<code><nowiki>ldap-utils</nowiki></code> 包也需要编辑。打开 <code><nowiki>/etc/ldap/ldap.conf</nowiki></code>, 按照下面两行编辑: | |||
<pre><nowiki> | <pre><nowiki> | ||
BASE dc=example,dc=com | BASE dc=example,dc=com | ||
URI ldap://ldap.example.com | URI ldap://ldap.example.com | ||
</nowiki></pre> | </nowiki></pre> | ||
== | |||
== 运行 == | |||
对于自动挂载映射,autofs 在 LDAP 目录里。你只需要通过下面的代码运行 <code><nowiki>autofs</nowiki></code>: | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo /etc/init.d/autofs start | sudo /etc/init.d/autofs start | ||
</nowiki></pre> | </nowiki></pre> | ||
== | |||
== 测试 == | |||
使用mount命令测试一下自动挂载是不是启动成功了: | |||
<pre><nowiki> | <pre><nowiki> | ||
mount | grep automount | mount | grep automount |
2010年2月4日 (四) 05:57的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/AutofsLDAP }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/af | • {{#if: UbuntuHelp:AutofsLDAP|Afrikaans| [[::AutofsLDAP/zh/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/ar | • {{#if: UbuntuHelp:AutofsLDAP|العربية| [[::AutofsLDAP/zh/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/az | • {{#if: UbuntuHelp:AutofsLDAP|azərbaycanca| [[::AutofsLDAP/zh/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/bcc | • {{#if: UbuntuHelp:AutofsLDAP|جهلسری بلوچی| [[::AutofsLDAP/zh/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/bg | • {{#if: UbuntuHelp:AutofsLDAP|български| [[::AutofsLDAP/zh/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/br | • {{#if: UbuntuHelp:AutofsLDAP|brezhoneg| [[::AutofsLDAP/zh/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/ca | • {{#if: UbuntuHelp:AutofsLDAP|català| [[::AutofsLDAP/zh/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/cs | • {{#if: UbuntuHelp:AutofsLDAP|čeština| [[::AutofsLDAP/zh/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/de | • {{#if: UbuntuHelp:AutofsLDAP|Deutsch| [[::AutofsLDAP/zh/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/el | • {{#if: UbuntuHelp:AutofsLDAP|Ελληνικά| [[::AutofsLDAP/zh/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/es | • {{#if: UbuntuHelp:AutofsLDAP|español| [[::AutofsLDAP/zh/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/fa | • {{#if: UbuntuHelp:AutofsLDAP|فارسی| [[::AutofsLDAP/zh/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/fi | • {{#if: UbuntuHelp:AutofsLDAP|suomi| [[::AutofsLDAP/zh/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/fr | • {{#if: UbuntuHelp:AutofsLDAP|français| [[::AutofsLDAP/zh/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/gu | • {{#if: UbuntuHelp:AutofsLDAP|ગુજરાતી| [[::AutofsLDAP/zh/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/he | • {{#if: UbuntuHelp:AutofsLDAP|עברית| [[::AutofsLDAP/zh/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/hu | • {{#if: UbuntuHelp:AutofsLDAP|magyar| [[::AutofsLDAP/zh/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/id | • {{#if: UbuntuHelp:AutofsLDAP|Bahasa Indonesia| [[::AutofsLDAP/zh/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/it | • {{#if: UbuntuHelp:AutofsLDAP|italiano| [[::AutofsLDAP/zh/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/ja | • {{#if: UbuntuHelp:AutofsLDAP|日本語| [[::AutofsLDAP/zh/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/ko | • {{#if: UbuntuHelp:AutofsLDAP|한국어| [[::AutofsLDAP/zh/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/ksh | • {{#if: UbuntuHelp:AutofsLDAP|Ripoarisch| [[::AutofsLDAP/zh/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/mr | • {{#if: UbuntuHelp:AutofsLDAP|मराठी| [[::AutofsLDAP/zh/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/ms | • {{#if: UbuntuHelp:AutofsLDAP|Bahasa Melayu| [[::AutofsLDAP/zh/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/nl | • {{#if: UbuntuHelp:AutofsLDAP|Nederlands| [[::AutofsLDAP/zh/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/no | • {{#if: UbuntuHelp:AutofsLDAP|norsk| [[::AutofsLDAP/zh/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/oc | • {{#if: UbuntuHelp:AutofsLDAP|occitan| [[::AutofsLDAP/zh/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/pl | • {{#if: UbuntuHelp:AutofsLDAP|polski| [[::AutofsLDAP/zh/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/pt | • {{#if: UbuntuHelp:AutofsLDAP|português| [[::AutofsLDAP/zh/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/ro | • {{#if: UbuntuHelp:AutofsLDAP|română| [[::AutofsLDAP/zh/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/ru | • {{#if: UbuntuHelp:AutofsLDAP|русский| [[::AutofsLDAP/zh/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/si | • {{#if: UbuntuHelp:AutofsLDAP|සිංහල| [[::AutofsLDAP/zh/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/sq | • {{#if: UbuntuHelp:AutofsLDAP|shqip| [[::AutofsLDAP/zh/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/sr | • {{#if: UbuntuHelp:AutofsLDAP|српски / srpski| [[::AutofsLDAP/zh/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/sv | • {{#if: UbuntuHelp:AutofsLDAP|svenska| [[::AutofsLDAP/zh/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/th | • {{#if: UbuntuHelp:AutofsLDAP|ไทย| [[::AutofsLDAP/zh/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/tr | • {{#if: UbuntuHelp:AutofsLDAP|Türkçe| [[::AutofsLDAP/zh/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/vi | • {{#if: UbuntuHelp:AutofsLDAP|Tiếng Việt| [[::AutofsLDAP/zh/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/yue | • {{#if: UbuntuHelp:AutofsLDAP|粵語| [[::AutofsLDAP/zh/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/zh | • {{#if: UbuntuHelp:AutofsLDAP|中文| [[::AutofsLDAP/zh/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/zh-hans | • {{#if: UbuntuHelp:AutofsLDAP|中文(简体)| [[::AutofsLDAP/zh/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutofsLDAP | UbuntuHelp:AutofsLDAP | {{#if: | :}}AutofsLDAP/zh}}/zh-hant | • {{#if: UbuntuHelp:AutofsLDAP|中文(繁體)| [[::AutofsLDAP/zh/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:AutofsLDAP|:AutofsLDAP/zh|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :AutofsLDAP/zh/zh | | {{#ifexist: AutofsLDAP/zh/zh | | {{#ifeq: {{#titleparts:AutofsLDAP/zh|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:AutofsLDAP/zh|1|-1|}} | zh | | }}
介绍
自动挂载是通过网络挂载目录的先进方法,并且非常容易管理非常节省带宽。在这个指南里,autofs将通过LDAP目录来配置。这样,我们将拥有一个集中的配置,并且可以最大化的利用已经配置起来的LDAP。很不错吧?
安装
首先,automount 由内核模块和用户界面工具这两部分组成。比较新的GNU/Linux发布版已经把automount编译进内核。你只要安装用户界面工具就可以了。需要安装的用户工具包括:autofs-ldap ldap-utils
(参照 InstallingSoftware).
如果你只希望使用普通的配置文件,就不需要安装 autofs-ldap
。Autofs 介绍了安装过程.
配置
LDAP 自动挂载的配置有下面几部分组成:
- 配置 openldap 服务器,从而加载 autofs-ldap 模式
- 进入 LDAP 目录来定义挂载点
- 进入 LDAP 记录来定义目录
- 定义客户端使用 LDAP 的配置进行自动挂载
服务器(server)端
打开并修改 slapd 配置文件,让 slapd 后台程序加载 ldap 模式:/etc/ldap/schema/autofs-ldap.schema
:
sudo nano /etc/ldap/slapd.conf
在core.schema
和 cosine.schema
之后加入下面2行:
#Schema and objectClass definitions include /etc/ldap/schema/autofs.schema
最后重启 slapd 服务:
sudo /etc/init.d/slapd restart
组装 LDAP
在 LDAP 目录里, 你必须进入这两种记录:
- 定义挂载点的记录
- 定义挂载点下目录的记录
下面是一个基于 OpenLDAPServer 安装的记录:
dn: ou=admin,dc=example,dc=com ou: admin objectClass: top objectClass: organizationalUnit dn: ou=automount,ou=admin,dc=example,dc=com ou: automount objectClass: top objectClass: organizationalUnit dn: ou=auto.master,ou=automount,ou=admin,dc=example,dc=com ou: auto.master objectClass: top objectClass: automountMap dn: cn=/home,ou=auto.master,ou=automount,ou=admin,dc=example,dc=com cn: /home objectClass: top objectClass: automount automountInformation: ldap:ou=auto.home,ou=automount,ou=admin,dc=example,dc=com --timeout=60 --ghost dn: cn=lionel,ou=auto.home,ou=automount,ou=admin,dc=example,dc=com cn: lionel objectClass: top objectClass: automount automountInformation: -fstype=nfs,rw,hard,intr,nodev,exec,nosuid,rsize=8192,wsize=8192 nfs.example.com:/export/home/lionel
用户端
在用户端你只需要把 LDAP 的映射添加到挂载点的记录 /etc/nsswitch.conf
. 打开 /etc/nsswitch.conf
文件并且加入下面一行:
automount: files ldap
ldap-utils
包也需要编辑。打开 /etc/ldap/ldap.conf
, 按照下面两行编辑:
BASE dc=example,dc=com URI ldap://ldap.example.com
运行
对于自动挂载映射,autofs 在 LDAP 目录里。你只需要通过下面的代码运行 autofs
:
sudo /etc/init.d/autofs start
测试
使用mount命令测试一下自动挂载是不是启动成功了:
mount | grep automount automount(pid5058) on /home type autofs (rw,fd=4,pgrp=5058,minproto=2,maxproto=4)