Overview
Suppose we have the following entries in /etc/auto.master:
/misc /etc/auto.misc --timeout=60 /home /etc/auto.home --timeout=60
following entry in /etc/auto.misc:
cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
and the following entry in /etc/auto.home:
* server:/export/home/&
We want to convert them into the following LDAP entries in Penrose:
dn: nisMapName=auto.master,ou=Automounts,dc=NIS,dc=Example,dc=com objectClass: nisMap nisMapName: auto.master dn: cn=/misc,nisMapName=auto.master,ou=Automounts,dc=NIS,dc=Example,dc=com objectClass: nisObject nisMapEntry: ldap:nisMapName=auto.misc,ou=Automounts,dc=NIS,dc=Example,dc=com cn: /misc dn: cn=/home,nisMapName=auto.master,ou=Automounts,dc=NIS,dc=Example,dc=com objectClass: nisObject nisMapEntry: ldap:nisMapName=auto.home,ou=Automounts,dc=NIS,dc=Example,dc=com cn: /home dn: nisMapName=auto.misc,ou=Automounts,dc=NIS,dc=Example,dc=com objectClass: nisMap nisMapName: auto.misc dn: cn=cd,nisMapName=auto.misc,ou=Automounts,dc=NIS,dc=Example,dc=com objectClass: nisObject nisMapEntry: -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom cn: cd dn: nisMapName=auto.home,ou=Automounts,dc=NIS,dc=Example,dc=com objectClass: nisMap nisMapName: auto.home dn: cn=/,nisMapName=auto.home,ou=Automounts,dc=NIS,dc=Example,dc=com objectClass: nisObject nisMapEntry: server:/export/home/& cn: /
Configuration
Define the following source in sources.xml:
<source name="automounts"> <source-class>org.safehaus.penrose.nis.source.NISAutomountsSource</source-class> <connection-name>NIS</connection-name> <field name="automountMapName" primaryKey="true"/> <field name="automountKey" primaryKey="true"/> <field name="automountInformation"/> <field name="description"/> <parameter> <param-name>objectClasses</param-name> <param-value>automount</param-value> </parameter> <parameter> <param-name>base</param-name> <param-value>auto.master</param-value> </parameter> </source>
Then define the following entry in directory.xml:
<entry dn="ou=Automounts,dc=NIS,dc=Example,dc=com"> <entry-class>org.safehaus.penrose.nis.directory.NISAutomountsEntry</entry-class> <oc>organizationalUnit</oc> <at name="ou" rdn="true"> <constant>Automounts</constant> </at> <source> <source-name>automounts</source-name> </source> </entry>
Configuring AutoFS
Edit /etc/auto.master:
/misc ldap:localhost:nisMapName=auto.misc,ou=Automounts,dc=NIS,dc=example,dc=com --timeout=60 /home ldap:localhost:nisMapName=auto.home,ou=Automounts,dc=NIS,dc=example,dc=com --timeout=60
Restart AutoFS:
service autofs restart
To test AutoFS simply try to access the directory:
ls -l /home/test
Then validate with the mount command.
