| United States-English |
|
|
|
![]() |
Enhanced AutoFS Administrator's Guide: HP-UX 11i v1 > Chapter 3 Configuring
and Administering AutoFSShortcuts for AutoFS Maps |
|
This section includes information on the elements that you can use as shortcuts in AutoFS maps. You can use environment variables and wildcard characters as shortcuts in AutoFS maps. You can use an environment variable anywhere in a direct or indirect AutoFS map, except the first field, which specifies the local mount point. You must precede an environment variable by a dollar sign ($), or enclose it in curly braces {}. The following direct map uses a variable called HOST:
To assign a value to the variable, add the -D option to the AUTOMOUNTD_OPTIONS variable in the /etc/rc.config.d/nfsconf file; see the following example:
In the preceding example, the NFS server, sage, has subdirectories in its /export/private_files directory that are named after the hosts in its network. Every host in the network can use the same AutoFS map and the same AUTOMOUNTD_OPTIONS definition to mount its private files from the sage server. For example, when AutoFS starts up on the basil host, it assigns the value basil to the HOST variable. Then, when someone requests access to the local /private_files directory on basil, AutoFS mounts /export/private_files/basil from the sage server. You can use any environment variable that is set to a value in an AutoFS map. If you do not set the variable with the -D option in /etc/rc.config.d/nfsconf, AutoFS uses the current value of the environment variable on the local host.
You can use asterisk (*) in an indirect map as a wildcard character to represent the local subdirectory when you want the local subdirectory to be the same as the remote system name or the remote subdirectory. You can use ampersand (&) in a direct or indirect map as the remote system name or the remote subdirectory. Whatever is in the local directory name field replaces the ampersand character. If you have used asterisk to represent the local subdirectory, then whatever replaces asterisk (*) in the local subdirectory field also replaces ampersand (&) in the remote system name or remote subdirectory field.
The following example automounts users’ home directories. The home directories are physically located on the NFS server, basil, under the remote directory, /export/home. On the local NFS client, the home directories are mounted under /home. The following example contains a line from the AutoFS master map, /etc/auto_master, that lists the indirect map, /etc/auto_home:
The following example contains the line from the AutoFS indirect map, /etc/auto_home that mounts users’ home directories on demand.
A user’s home directory is configured in the /etc/passwd file as /home/username. For example, the home directory of user terry is /home/terry. When Terry logs on, AutoFS looks into the /etc/auto_home map and substitutes terry for both asterisk and ampersand. AutoFS then mounts Terry’s home directory from /export/home/terry on the basil server to /home/terry on the local NFS client. You can use the ampersand character to represent both the remote server and the remote subdirectory in the same line of the indirect map. For example, if users’ home directories are physically located on many different servers, but the directory under which the home directories are located is called /export/home/servername on all the servers, the following line in the /etc/auto_home map mounts all users’ home directories from any server:
Consider that the home directory of user terry is configured in the /etc/passwd file as /home/basil/terry. When Terry logs on, AutoFS mounts the remote directory /export/home/basil from the basil server on the local directory, /home/basil. The line with the asterisk and ampersand characters should be the last line in an indirect map. AutoFS reads the lines in the indirect map sequentially until it finds a match for the requested local subdirectory. The asterisk (*) character matches any subdirectory. Therefore, AutoFS stops reading at the line with the asterisk character because it finds a match. The lines in the map after the line with the asterisk character are never read. Consider the following example:
If the /etc/auto_home map contains the preceding lines, AutoFS attempts to mount /export/home/charlie from the basil host. The asterisk character is a match for charlie; therefore, AutoFS does not read the second line. Now, consider the following example:
If the /etc/auto_home map contains the preceding lines, AutoFS mounts Charlie’s home directory from the thyme host and everyone else’s home directory from the basil host. For more information on the AutoFS configuration, see the automount(1M) man page. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||