Go to main content

Managing Network File Systems in Oracle® Solaris 11.4

Exit Print View

Updated: August 2021
 
 

Autofs Reference

This section describes more advanced autofs features and topics.

Autofs and Metacharacters

Autofs recognizes some characters as having a special meaning. For example, some characters are used for substitutions and some characters are used to protect other characters from the autofs map parser.

Ampersand (&) and NFS

If you have a map with many subdirectories specified, as in the following example, consider using string substitutions.

john        willow:/home/john
mary        willow:/home/mary
dollyp      willow:/home/dollyp
able        pine:/export/able
baker       peach:/export/baker

You can use the ampersand character (&) to substitute the key wherever the key appears. If you use the ampersand, the previous map changes to the following text:

john     willow:/home/&
mary      willow:/home/&
dollyp    willow:/home/&
able      pine:/export/&
baker     peach:/export/&

You could also use key substitutions in a direct map in situations such as the following example:

/usr/man						willow,cedar,poplar:/usr/man

You can also simplify the entry further as follows:

/usr/man						willow,cedar,poplar:&

Notice that the ampersand substitution uses the whole key string. Therefore, if the key in a direct map starts with a / (as it should), the slash is included in the substitution. Consequently, for example, you could not include the following entry:

/progs				&1,&2,&3:/export/src/progs 

Autofs would interpret the example as follows:

/progs 				/progs1,/progs2,/progs3:/export/src/progs

Asterisk (*) and NFS

You can use the universal substitute character, the asterisk (*), to match any key. For example, you could mount the /export file system from all hosts through this map entry.

*						&:/export

Each ampersand is substituted by the value of any given key. Autofs interprets the asterisk as an end-of-file character.

Autofs and Special Characters

If you have a map entry that contains special characters, you might have to mount directories that have names that the autofs map parser cannot process properly. The autofs parser is sensitive to names that contain colons, commas, and spaces, for example. These names should be enclosed in double quotes, as in the following example:

/vms    -ro    vmsserver: -  -  - "rc0:dk1 - "
/mac    -ro    gator:/ - "Mr Disk - "