Setting Up NIS+ Automount Maps

The setup and administration of automounting on a network running NIS+ involves creating and maintaining NIS+ automount maps. The steps in the following sections describe how to create these maps on the NIS+ root master server. See “Administering NIS+ Automount Maps” for information on how to modify existing maps.

Setting Up the auto_home Map

The auto_home map is created when you set up the NIS+ root master server and populated when you run the nispopulate command. You do not need to create it separately. You do not need to make an entry for the auto_home map in the NIS+ auto_master map. The entry is already included in the default auto_master map.

Setting Up Indirect Maps

Use the NIS+ command nistbladm to create and edit indirect maps on the NIS+ root master server.

NOTE

The nistbladm command requires a fully qualified name for the table—that is, the name of the table, followed by the directory where the NIS+ tables are stored and the domain name. Note that for NIS+ commands, the domain name of a fully qualified name ends in a period. For example, auto_master.org_dir.wellard.com. is the fully qualified name for the auto_master table, which is in the directory org_dir in the wellard.COM. domain.


  1. Decide which indirect maps you want to create. Make a list of the mount points, the servers, and the path names for each indirect map.

  2. Log in to the NIS+ root master server.

    If you are a member of the group that has permission to edit NIS+ automount tables, you can edit the tables as yourself. Otherwise, you must become superuser on the NIS+ root master.

  3. For each indirect map you want to create, all on one line, type nistbladm -c automount_map key=S value=S auto_table-name.org_dir.domainname and press Return.

    The -c option creates the automount table, creates two columns named key and value—which are searchable—and assigns the table name auto_table-name. Note that any mount options you specify are part of the value.

  4. For each entry in the table, all on one line, type nistbladm -a key=mount-point value=options,pathname auto_table-name.org_dir.domainname and press Return.

    The -a option adds the entry to the table you specify, and the values are assigned to the columns.

  5. To display the values in the table, all on one line, type niscat -v auto_table-name.org_dir.domainname and press Return.

  6. For each map you create, you must add an entry to the auto_master map.

    1. To display existing entries in the auto_master map, all on one line, type niscat -o auto_master.org_dir.domainname and press Return.

    2. To add a new entry to the auto_master map, all on one line, type nistbladm -a key=mount-point value=map-name auto_master.org_dir.domainname and press Return.

  7. On each NFS client, type automount and press Return.

    Every file system that is currently not mounted by the automounter is updated. Any file system currently mounted is remounted at the new location if it is unmounted and reaccessed after the automount command is run.

NOTE

The auto_master map is read only at boot time or when you manually run the automount command. After you have created new indirect maps and have added the mount point and map name to the auto_master map, run the automount command on any NFS clients to reread the automount maps. If the NFS server is also an NFS client of itself, also run the automount command on the NFS server.


The following example creates an indirect automount map named auto_local in the org_dir domain for wellard.COM.. Two rows are entered in the table and the indirect map is added to the NIS+ auto_master table.

oak% su
Password:
oak# nistbladm -c automount_map key=S value=S auto_local.org_dir.wellard.COM.
oak# nistbladm -a key=openwin value=oak:/usr/openwin
							 auto_local.org_dir.wellard.COM.
oak# nistbladm -a key=frame6.0 value=ash:/usr/local/frame6.0
							 auto_local.org_dir.wellard.COM.
oak# niscat -v auto_local.org_dir.wellard.COM.
openwin  oak:/usr/openwin
frame6.0  ash:/usr/local/frame6.0
oak# niscat -o auto_master.org_dir.wellard.COM.
Object Name   : auto_master
Owner         : oak.wellard.COM.
Group         : admin.wellard.COM
Domain        : org_dir.wellard.COM.
Access Rights : ----rmcdrmcdr---
Time to Live  : 12:0:0
Object Type   : TABLE
Table Type          : automount_map
Number of Columns   : 2
Character Separator :  
Search Path         :
Columns             :
        [0]     Name          : key
                Attributes    : (SEARCHABLE, TEXTUAL DATA, CASE SENSITIVE)
                Access Rights : ----------------
        [1]     Name          : value
                Attributes    : (TEXTUAL DATA)
                Access Rights : ----------------
oak# nistbladm -a key=/bin value=auto_local auto_master.org_dir.wellard.COM.
oak# niscat -v auto_master.org_dir.wellard.COM.
/bin auto_local
oak#

Setting Up a Direct Map

You can set up a direct map in the same way that you set up indirect maps—with the NIS+ nistbladm command.

Use the following steps to set up a direct map.

1.
Add the /- entry to the auto_master map if the entry doesn't already exist.

2.
Use the nistbladm -c command to add the auto_direct map to NIS+.

3.
Use the nistbladm -a command to add entries to the auto_direct map.

4.
Reboot each of the NFS clients.

Regardless of which version of Solaris is running, you need to reboot each NFS client to reset an automount direct map, which is a good reason to use as few direct automount entries as possible. Indirect automount map entries don't have this limitation.

The following example sets up a direct map named auto_direct—with one entry for automounting manual pages—and adds it to the auto_master map.

oak% su
Password:
oak# nistbladm -c automount_map key=S value=S auto_direct.org_dir.wellard.COM.
oak# nistbladm -a key=/usr/man value=-ro,oak:/usr/share/man
							 auto_direct.org_dir.wellard.COM.
oak# niscat -v auto_direct.org_dir.wellard.COM.
/usr/man  -ro  oak:/usr/share/man
oak# niscat -o auto_master.org_dir
Object Name   : auto_master
Owner         : oak.wellard.COM.
Group         : admin.wellard.COM
Domain        : org_dir.wellard.COM.
Access Rights : ----rmcdrmcdr---
Time to Live  : 12:0:0
Object Type   : TABLE
Table Type          : automount_map
Number of Columns   : 2
Character Separator :
Search Path         :
Columns             :
        [0]     Name          : key
                Attributes    : (SEARCHABLE, TEXTUAL DATA, CASE SENSITIVE)
                Access Rights : ----------------
        [1]     Name          : value
                Attributes    : (TEXTUAL DATA)
                Access Rights : ----------------
oak# nistbladm -a key=/- value=auto_direct auto_master.org_dir.wellard.COM.
oak# niscat -v auto_master.org_dir.wellard.COM.
/- auto_direct
oak#

Setting Up the NIS+ Master Map

When the NIS+ root master server is configured, the NIS+ auto_master map is created automatically. You do not need to create it as a separate step.

You do, however, need to provide an entry in the NIS+ auto_master map for the single direct map and for any additional indirect maps that you create.

The section “Setting Up Indirect Maps” contains information on how to edit the NIS+ auto_master map. That information is summarized here for your reference.

Use the following steps to add an entry to the NIS+ auto_master map.

1.
Display the names of the columns in the auto_master map by typing niscat -o auto_master.org_dir.domain-name and pressing Return.

2.
To add each entry, all on one line, type nistbladm -a key=mount-point value=map-name auto_master.org_dir.domain-name and press Return.

3.
On each NFS client, type automount and press Return.

Every file system that is currently not mounted by the automounter is updated. Any file system currently mounted is remounted at the new location if it is unmounted and reaccessed after the automount command is run.

Creating a Project Automount Map

If you are administering a large software development project, you can create a project automount map to make all project-related files available under a /project directory or a set of directories by project name. The following example creates a /project directory and an auto_project map that are accessible to all workstations on the network.

  1. Add an entry for the /project directory to the NIS or NIS+ auto_master map.

    /project     auto_project     -nosuid
    

    The auto_project map determines the contents of the /project directory. As a security precaution, the -nosuid option prevents users from running any setuid programs.

  2. Create the auto_project map so that each entry describes a subproject, as shown in the following example.

    compiler
         /vers1.0     alpha:/export/project/&/vers1.0
         /vers2.0     gamma:/export/project/&/vers2.0
         /man         gamma:/export/project/&/man
    windows
         /vers1.0     alpha:/export/project/&/vers1.0
         /man         gamma:/export/project/&/man
    files
         /vers1.0     alpha:/export/project/&/vers1.0
         /vers2.0     gamma:/export/project/&/vers2.0
         /vers3.0     gamma:/export/project/&/vers3.0
         /man         gamma:/export/project/&/man
    drivers
         /vers1.0     alpha:/export/project/&/vers1.0
         /man         gamma:/export/project/&/man
    tools
         /            charlie:/export/project/&
    

    The ampersand (&) at the end of each entry is an abbreviation for the entry key. See “Metacharacters” for more information about using metacharacters in automount maps.

As the project proceeds, you can relocate and expand various disk partitions as needed by modifying the auto_project map without needing to notify users. Because the NFS servers view the same autofs map as the NFS clients, any users who log in to the NFS servers can find the /project namespace. These users are provided with direct access to local files through loopback mounts instead of NFS mounts.

Creating Hierarchical Maps

Starting with the Solaris 2.4 release, autofs supports hierarchical automount maps.

Do not use the -soft option when specifying hierarchical layers. If you use the -soft option, requests to reinstall the trigger nodes can time out. Failure to reinstall the trigger nodes leaves no access to the next level of mounts. The only way to clear this problem is either to wait for the file systems to be automatically unmounted by the automounter or to reboot the system.

Suppose you have an /etc/auto_master file that contains the following entry.

/share    auto_share

The auto_share map is shown below.

# share directory map for automounter
#
ws     /     castle:/export/share/ws

When a user accesses the /share/ws directory, the autofs service creates a trigger node for /share/ws.

The following example expands the auto_share map to contain hierarchical mount points.

# share directory map for automounter
#
ws     /     castle:/export/share/ws
       /usr  castle:/export/share/ws/usr

When a user accesses the /share/ws mount point, autofs creates the /share/ws trigger node. In addition, it creates a trigger node to the next level (/usr) so that the next level can be mounted if it is accessed.

Hierarchical mounts are unmounted from the bottom up in the reverse order of mounting. If one of the higher-level directories is busy, only file systems below that level are unmounted. Any trigger nodes are removed and then the file system is unmounted. If the file system is busy, the unmount fails and the trigger nodes are reinstalled.

Administering NIS+ Automount Maps

The following sections describe how to modify entries in existing automount maps and how to delete entries from NIS+ automount maps.

Modifying NIS+ Automount Maps

You can use the -A option for nistbladm to force an overwrite of information in an existing NIS+ automount map.

The syntax for the nistbladm -A option is shown below. You must specify a value for each of the columns in the table.

nistbladm -A column= ... table-name.domainname
							

The more specific syntax for NIS+ automount tables is shown below.

nistbladm -A key=
								value= auto_name.org_dir.domainname
							

In the following example, the administrator typed key=bin instead of key=/bin for the auto_local entry in the auto_master table.

# nistbladm -A key=bin value=auto_local auto_master.org_dir.wellard.com.
# niscat auto_master.org_dir
+auto_master
/net -hosts             -nosuid,nobrowse
/home auto_home -nobrowse
/xfn -xfn
bin auto_local
#

When the system booted, the automounter displayed the following error messages informing the administrator that the name bin in the auto_master table needed to be changed to /bin.

automount:  dir bin must start with '/'
automount:  /bin: Not a directory

The following entry corrects the problem.

# nistbladm -A key=/bin value=auto_local auto_master.org_dir.wellard.com.
# niscat auto_master.org_dir
+auto_master 
/net -hosts             -nosuid,nobrowse
/home auto_home -nobrowse
/xfn -xfn
/bin auto_local
#

Deleting Entries from NIS+ Automount Maps

You can delete rows from NIS+ automount maps with the nistbladm -r command by specifying one of the columns.

The syntax for the nistbladm -r option is shown below.

nistbladm -r column= table-name.domainname
							

The more specific syntax for NIS+ automount tables is shown below.

nistbladm -r column= auto_name.org_dir.domainname

If you create an incorrect entry, you can delete it. The administrator who created the key=bin value=auto_local entry in the NIS+ auto_master map can delete the entry and then create a new one, as shown in the following example.

oak% niscat -v auto_master.org_dir.wellard.COM.
bin  auto_local
/-  auto_direct
oak% nistbladm -r key=bin auto_master.org_dir.wellard.COM.
oak% niscat -v auto_master.org_dir.wellard.COM.
/-  auto_direct
oak% nistbladm -a key=/bin value=auto_local auto_master,org_dir.wellard.COM.
oak% niscat -v auto_master.org_dir.wellard.COM.
/bin  auto_local
/-  auto_direct
oak%

Using a Public File Handle with the Automounter

The Solaris 7 release introduced extensions to the mount and automountd command that enable the mount request to use the public file handle instead of the MOUNT protocol. This access method is the one used by the WebNFS service. By circumventing the MOUNT protocol, you can do the mount through a firewall. In addition, because fewer transactions are needed between the server and the client, the mount is faster. See Chapter 9, “Introducing WebNFS,” for more information on the WebNFS protocol.

Follow these steps to use a public file handle with the automounter.

1.
Become superuser.

2.
In the automounter map, add the entry /usr/local -ro,public server:/filesystem

The following example adds a public file handle for the /export/share/local file system on castle.

/usr/local     -ro,public     castle:/export/share/local

The public option forces use of the public handle. If the NFS server does not support a public file handle, the mount fails.

Mounts can fail with the -public option in certain conditions. Adding an NFS URL can also confuse the situation. The following list describes how a file system is mounted when the -public option is used.

  • Using the public option with an NFS URL forces the use of the public file handle. The mount fails if the public file handle is not supported.

  • Using the public option with a regular path forces the use of the public file handle. The mount fails if the public file handle is not supported.

  • With an NFS URL only, use the public file handle if enabled on the NFS server. If the mount fails with the public file handle, try the mount with the mount protocol.

  • Regular path only, do not use the public file handle. Use the MOUNT protocol.

The default public file handle (which is 0000) skips all of the transactions to get information from the portmap service and to determine the NFS port number.

Using NFS URLs with the Automounter

The Solaris 2.6 release introduced an extension to the NFS protocol to make a file system on the Internet accessible through firewalls. The service is an extension of the NFS version 3 and version 2 protocol. An NFS server provides greater throughput under a heavy load than does HyperText Transfer Protocol (HTTP) access to a Web server. This greater throughput can decrease the time required to retrieve a file. In addition, the WebNFS protocol provides the capability of sharing files without the administrative overhead of an anonymous FTP site.

Use the following steps to use NFS URLs with the automounter.

1.
Become superuser.

2.
In the automounter map, add the entry /usr/local -ro nfs://server/filesystem.

The following example adds an NFS URL for the /export/share/local file system on castle.

/usr/local     -ro     nfs://castle/export/share/local

See Chapter 9, “Introducing WebNFS,” for more information on the WebNFS protocol.

Disabling Automounter Browsability

Automounter browsability was introduced in the Solaris 2.6 release. The browse feature enables all of the potential mount points to be visible, regardless of whether they are mounted. You can turn off the browse feature with the -nobrowse option. Although the default version of the /etc/auto_master file specifies the -nobrowse option for the /home and /net entries, you may need to make manual changes or turn off browsability for site-specific autofs mount points after installation.

You can turn off the browsability feature in several ways.

  • Disable browsability with the -n command-line option to the automountd daemon. This command completely disables autofs browsability for the NFS client.

  • Disable browsability for each map entry on all clients that use autofs maps in either an NIS or NIS+ namespace.

  • Disable browsability for each map entry on each client that uses local autofs maps if no nameservice is used.

How to Completely Disable Autofs Browsability on a Single NFS Client

Use the following steps to completely disable autofs browsability on a single NFS client.

1.
On the NFS client, become superuser.

2.
As root, edit the /etc/init.d/autofs script and add the -n option to the line that starts the automountd daemon, as shown below.

/usr/lib/autofs/automountd -n < /dev/null > /dev/console 2>&1 # start daemon

3.
Reboot the NFS client to restart the autofs service.

How to Disable Autofs Browsability for All NFS Clients

You must use a nameservice such as NIS or NIS+ to disable browsability for all clients.

  1. Add the -nobrowse option to each indirect map entry in the nameservice auto_master file.

  2. On each NFS client, run the automount command.

    The new behavior takes effect after you run the automount command on the client system or after the system is rebooted.

If you are not using a nameservice, for each NFS client, manually edit the automounter maps, add the -nobrowse option to the indirect maps that you want to disable, and run the automount command.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.13.210