个人工具

“UbuntuHelp:AutofsLDAP/zh”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(创建新页面为 '{{Translation}} {{From|https://help.ubuntu.com/community/AutofsLDAP}} {{Translator|kmeng}} {{Languages|UbuntuHelp:AutofsLDAP}} == 介绍 == 自动挂载是通过网络挂载目...')
 
 
(未显示同一用户的11个中间版本)
第1行: 第1行:
{{Translation}}
+
{{Copyedit translation}}
 
{{From|https://help.ubuntu.com/community/AutofsLDAP}}
 
{{From|https://help.ubuntu.com/community/AutofsLDAP}}
 
{{Translator|kmeng}}
 
{{Translator|kmeng}}
 
{{Languages|UbuntuHelp:AutofsLDAP}}
 
{{Languages|UbuntuHelp:AutofsLDAP}}
 
== 介绍 ==
 
== 介绍 ==
自动挂载是通过网络挂载目录的先进方法,并且非常容易管理非常节省带宽。在这里,autofs将通过LDAP目录来配置。这样,我们将拥有一个集中的配置,并且可以最大化的利用已经配置起来的LDAP。很不错吧?
+
自动挂载是通过网络挂载目录的先进方法,并且非常容易管理非常节省带宽。在这个指南里,autofs将通过LDAP目录来配置。这样,我们将拥有一个集中的配置,并且可以最大化的利用已经配置起来的LDAP。很不错吧?
== Installation ==
+
 
First of all, automount is composed of two parts: a kernel module and user land utilities. Kernels in modern GNU/Linux distributions are compiled with support for automount. You just have to install the user land utilities: install the following packages <code><nowiki>autofs-ldap ldap-utils</nowiki></code> (see [[UbuntuHelp:InstallingSoftware|InstallingSoftware]]).
+
== 安装 ==
If you plan to only use flat files configuration, you do not need to install the <code><nowiki>autofs-ldap </nowiki></code> package: installation is described in [[UbuntuHelp:Autofs|Autofs]] howto.
+
首先,automount 由内核模块和用户界面工具这两部分组成。比较新的GNU/Linux发布版已经把automount编译进内核。你只要安装用户界面工具就可以了。需要安装的用户工具包括:<code><nowiki>autofs-ldap ldap-utils</nowiki></code> (参照 [[UbuntuHelp:InstallingSoftware|InstallingSoftware]]).
== Configuration ==
+
如果你只希望使用普通的配置文件,就不需要安装 <code><nowiki>autofs-ldap </nowiki></code>[[UbuntuHelp:Autofs|Autofs]] 介绍了安装过程.
Configuring LDAP automount consists of several parts:
+
 
* configure openldap server to load the autofs-ldap schema
+
== 配置 ==
* entering LDAP entries for defining mountpoints
+
LDAP 自动挂载的配置有下面几部分组成:
* entering LDAP entries for defining directories
+
* 配置 openldap 服务器,从而加载 autofs-ldap 模式
* defining on the client to use LDAP for automount configuration
+
* 进入 LDAP 目录来定义挂载点
=== On the server ===
+
* 进入 LDAP 记录来定义目录
Tell the slapd daemon to load <code><nowiki>/etc/ldap/schema/autofs-ldap.schema</nowiki></code>:
+
* 定义客户端使用 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>
and add the line
+
在<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>
The <code><nowiki>autofs.schema</nowiki></code> line must be inserted after <code><nowiki>core.schema</nowiki></code> and <code><nowiki>cosine.schema</nowiki></code>
+
最后重启 slapd 服务:
Finally restart the slapd service:
+
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo /etc/init.d/slapd restart
 
sudo /etc/init.d/slapd restart
 
</nowiki></pre>
 
</nowiki></pre>
=== Populating LDAP ===
+
 
In the LDAP directory, you have to enter two kinds of entries:
+
=== 组装 LDAP ===
* entry that defines the mountpoint
+
LDAP 目录里, 你必须进入这两种记录:
* entry that defines the directory under a mountpoint
+
* 定义挂载点的记录
Here is an example of LDAP entries based on the [[UbuntuHelp:OpenLDAPServer|OpenLDAPServer]] installation.
+
* 定义挂载点下目录的记录
 +
下面是一个基于 [[UbuntuHelp:OpenLDAPServer|OpenLDAPServer]] 安装的记录:
 
<pre><nowiki>
 
<pre><nowiki>
 
dn: ou=admin,dc=example,dc=com
 
dn: ou=admin,dc=example,dc=com
第62行: 第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>
=== On the client ===
+
 
On the client, you only have to add the LDAP map to the automount entry of <code><nowiki>/etc/nsswitch.conf</nowiki></code>. Edit your <code><nowiki>/etc/nsswitch.conf</nowiki></code> and add the line:
+
=== 用户端 ===
 +
在用户端你只需要把 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>
The package <code><nowiki>ldap-utils</nowiki></code> has to be configured. Edit <code><nowiki>/etc/ldap/ldap.conf</nowiki></code>:
+
<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>
== Launch ==
+
 
autofs looks in the LDAP directory for the automountMap. You just have to launch <code><nowiki>autofs</nowiki></code>:
+
== 运行 ==
 +
对于自动挂载映射,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>
== Test ==
+
 
Just check with a mount that automount has been started correctly:
+
== 测试 ==
 +
使用mount命令测试一下自动挂载是不是启动成功了:
 
<pre><nowiki>
 
<pre><nowiki>
 
mount | grep automount
 
mount | grep automount

2010年2月4日 (四) 05:57的最新版本

介绍

自动挂载是通过网络挂载目录的先进方法,并且非常容易管理非常节省带宽。在这个指南里,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.schemacosine.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)