个人工具

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

来自Ubuntu中文

跳转至: 导航, 搜索
第2行: 第2行:
 
{{Languages|UbuntuHelp:AutofsLDAP}}
 
{{Languages|UbuntuHelp:AutofsLDAP}}
 
== Introduction ==
 
== Introduction ==
 
 
Automount is the modern way to mount directories over a network. It is far much easier to manage and are more economic in bandwith.
 
Automount is the modern way to mount directories over a network. It is far much easier to manage and are more economic in bandwith.
 
 
In this howto, autofs will be configured through LDAP directory: in that way, we have a centralised configuration and we use a maximum the LDAP that has been setup. Great, isn't it ?
 
In this howto, autofs will be configured through LDAP directory: in that way, we have a centralised configuration and we use a maximum the LDAP that has been setup. Great, isn't it ?
 
 
== Installation ==
 
== Installation ==
 
 
First of all, automount is composed of two parts : kernel module and user land utilities. Kernels in modern GNU/Linux distributions are compiled with support for automount. You just have to install user land utilities : install the following packages <code><nowiki>autofs-ldap ldap-utils</nowiki></code> (see InstallingSoftware).
 
First of all, automount is composed of two parts : kernel module and user land utilities. Kernels in modern GNU/Linux distributions are compiled with support for automount. You just have to install user land utilities : install the following packages <code><nowiki>autofs-ldap ldap-utils</nowiki></code> (see 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]] howto.
 
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]] howto.
 
 
 
== Configuration ==
 
== Configuration ==
 
 
Configuring LDAP automount consists of several parts:
 
Configuring LDAP automount consists of several parts:
 
* configure openldap server to load the autofs-ldap schema
 
* configure openldap server to load the autofs-ldap schema
第21行: 第13行:
 
* entering LDAP entries for defining directories
 
* entering LDAP entries for defining directories
 
* defining on the client to use LDAP for automount configuration
 
* defining on the client to use LDAP for automount configuration
 
 
 
=== On the server ===
 
=== On the server ===
 
 
Tell the slapd daemon to load <code><nowiki>/etc/ldap/schema/autofs-ldap.schema</nowiki></code>:
 
Tell the slapd daemon to load <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
 
and add the line
 
 
<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>
 
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>
 
 
Finally restart the slapd service:
 
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 ===
 
=== Populating LDAP ===
 
 
In the LDAP directory, you have to enter two kind of entries:
 
In the LDAP directory, you have to enter two kind of entries:
 
* entries that defines the mountpoint
 
* entries that defines the mountpoint
 
* entries that defines the directory under a mountpoint
 
* entries that defines the directory under a mountpoint
 
 
Here is an example of LDAP entries based on the [[UbuntuHelp:OpenLDAPServer]] installation.  
 
Here is an example of LDAP entries based on the [[UbuntuHelp:OpenLDAPServer]] installation.  
 
 
<pre><nowiki>
 
<pre><nowiki>
 
dn: ou=admin,dc=example,dc=com
 
dn: ou=admin,dc=example,dc=com
第60行: 第38行:
 
objectClass: top
 
objectClass: top
 
objectClass: organizationalUnit
 
objectClass: organizationalUnit
 
 
dn: ou=automount,ou=admin,dc=example,dc=com
 
dn: ou=automount,ou=admin,dc=example,dc=com
 
ou: automount
 
ou: automount
 
objectClass: top
 
objectClass: top
 
objectClass: organizationalUnit
 
objectClass: organizationalUnit
 
 
dn: ou=auto.master,ou=automount,ou=admin,dc=example,dc=com
 
dn: ou=auto.master,ou=automount,ou=admin,dc=example,dc=com
 
ou: auto.master
 
ou: auto.master
 
objectClass: top
 
objectClass: top
 
objectClass: automountMap
 
objectClass: automountMap
 
 
dn: cn=/home,ou=auto.master,ou=automount,ou=admin,dc=example,dc=com
 
dn: cn=/home,ou=auto.master,ou=automount,ou=admin,dc=example,dc=com
 
cn: /home
 
cn: /home
第76行: 第51行:
 
objectClass: automount
 
objectClass: automount
 
automountInformation: ldap:ou=auto.home,ou=automount,ou=admin,dc=example,dc=com --timeout=60 --ghost
 
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
 
dn: cn=lionel,ou=auto.home,ou=automount,ou=admin,dc=example,dc=com
 
cn: lionel
 
cn: lionel
第83行: 第57行:
 
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 ===
 
 
On the client, you only have to add LDAP map to the automount entry of <code><nowiki>/etc/nsswitch.conf</nowiki></code>. Edit you <code><nowiki>/etc/nsswitch.conf</nowiki></code> and add the line:
 
On the client, you only have to add LDAP map to the automount entry of <code><nowiki>/etc/nsswitch.conf</nowiki></code>. Edit you <code><nowiki>/etc/nsswitch.conf</nowiki></code> and add the line:
 
 
<pre><nowiki>
 
<pre><nowiki>
 
automount:      files ldap
 
automount:      files ldap
 
</nowiki></pre>
 
</nowiki></pre>
 
 
The package <code><nowiki>ldap-utils</nowiki></code> have to be configured. Edit <code><nowiki>/etc/ldap/ldap.conf</nowiki></code>:
 
The package <code><nowiki>ldap-utils</nowiki></code> have to be configured. Edit <code><nowiki>/etc/ldap/ldap.conf</nowiki></code>:
 
<pre><nowiki>
 
<pre><nowiki>
第98行: 第67行:
 
URI    ldap://ldap.example.com
 
URI    ldap://ldap.example.com
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
== Launch ==
 
== Launch ==
 
 
autofs look in the LDAP directory for automountMap. You just have to launch <code><nowiki>autofs</nowiki></code>:
 
autofs look in the LDAP directory for automountMap. You just have to launch <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 ==
 
== Test ==
 
 
Just check with a mount that automount is well launched:
 
Just check with a mount that automount is well launched:
 
 
<pre><nowiki>
 
<pre><nowiki>
 
mount | grep automount
 
mount | grep automount

2007年11月30日 (五) 16:10的版本


Introduction

Automount is the modern way to mount directories over a network. It is far much easier to manage and are more economic in bandwith. In this howto, autofs will be configured through LDAP directory: in that way, we have a centralised configuration and we use a maximum the LDAP that has been setup. Great, isn't it ?

Installation

First of all, automount is composed of two parts : kernel module and user land utilities. Kernels in modern GNU/Linux distributions are compiled with support for automount. You just have to install user land utilities : install the following packages autofs-ldap ldap-utils (see InstallingSoftware). If you plan to only use flat files configuration, you do not need to install the autofs-ldap package: installation is described in UbuntuHelp:Autofs howto.

Configuration

Configuring LDAP automount consists of several parts:

  • configure openldap server to load the autofs-ldap schema
  • entering LDAP entries for defining mountpoints
  • entering LDAP entries for defining directories
  • defining on the client to use LDAP for automount configuration

On the server

Tell the slapd daemon to load /etc/ldap/schema/autofs-ldap.schema:

sudo nano /etc/ldap/slapd.conf

and add the line

#Schema and objectClass definitions
include /etc/ldap/schema/autofs.schema

The autofs.schema line must be inserted after core.schema and cosine.schema Finally restart the slapd service:

sudo /etc/init.d/slapd restart

Populating LDAP

In the LDAP directory, you have to enter two kind of entries:

  • entries that defines the mountpoint
  • entries that defines the directory under a mountpoint

Here is an example of LDAP entries based on the UbuntuHelp:OpenLDAPServer installation.

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

On the client

On the client, you only have to add LDAP map to the automount entry of /etc/nsswitch.conf. Edit you /etc/nsswitch.conf and add the line:

automount:      files ldap

The package ldap-utils have to be configured. Edit /etc/ldap/ldap.conf:

BASE    dc=example,dc=com
URI     ldap://ldap.example.com

Launch

autofs look in the LDAP directory for automountMap. You just have to launch autofs:

sudo /etc/init.d/autofs start

Test

Just check with a mount that automount is well launched:

mount | grep automount
automount(pid5058) on /home type autofs (rw,fd=4,pgrp=5058,minproto=2,maxproto=4)