8547 update mandoc to 1.14.3
[unleashed.git] / usr / src / man / man1m / automount.1m
blob111e1a512cbc8d47b39bbd705a5cd8b478b12e13
1 .\"
2 .\" The contents of this file are subject to the terms of the
3 .\" Common Development and Distribution License (the "License").
4 .\" You may not use this file except in compliance with the License.
5 .\"
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7 .\" or http://www.opensolaris.org/os/licensing.
8 .\" See the License for the specific language governing permissions
9 .\" and limitations under the License.
10 .\"
11 .\" When distributing Covered Code, include this CDDL HEADER in each
12 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
13 .\" If applicable, add the following below this CDDL HEADER, with the
14 .\" fields enclosed by brackets "[]" replaced with your own identifying
15 .\" information: Portions Copyright [yyyy] [name of copyright owner]
16 .\"
17 .\"
18 .\" Copyright 1989 AT&T
19 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
20 .\" Copyright 2017 Nexenta Systems, Inc.
21 .\"
22 .Dd February 25, 2017
23 .Dt AUTOMOUNT 1M
24 .Os
25 .Sh NAME
26 .Nm automount
27 .Nd install automatic mount points
28 .Sh SYNOPSIS
29 .Nm
30 .Op Fl v
31 .Op Fl t Ar duration
32 .Sh DESCRIPTION
33 The
34 .Nm
35 utility installs
36 .Nm autofs
37 mount points and associates an automount map with each mount point.
38 It starts the
39 .Xr automountd 1M
40 daemon if it finds any non-trivial entries in either local or distributed
41 automount maps and if the daemon is not already running.
42 The
43 .Nm autofs
44 file system monitors attempts to access directories within it and notifies the
45 .Xr automountd 1M
46 daemon.
47 The daemon uses the map to locate a file system, which it then mounts at the
48 point of reference within the
49 .Nm autofs
50 file system.
51 A map can be assigned to an
52 .Nm autofs
53 mount using an entry in the
54 .Pa /etc/auto_master
55 map or a direct map.
56 .Pp
57 If the file system is not accessed within an appropriate interval
58 .Pq 10 minutes by default ,
59 the
60 .Nm automountd
61 daemon unmounts the file system.
62 .Pp
63 The file
64 .Pa /etc/auto_master
65 determines the locations of all
66 .Nm autofs
67 mount points.
68 By default, this file contains three entries:
69 .Bd -literal -offset indent
70 # Master map for automounter
72 +auto_master
73 /net    -hosts -nosuid
74 /home   auto_home
75 .Ed
76 .Pp
77 The
78 .Sy +auto_master
79 entry is a reference to an external NIS master map.
80 If one exists, then its entries are read as if they occurred in place of the
81 .Sy +auto_master
82 entry.
83 The remaining entries in the master file specify a directory on which an
84 .Nm autofs
85 mount will be made followed by the automounter map to be associated with it.
86 Optional mount options may be supplied as an optional third field in the each
87 entry.
88 These options are used for any entries in the map that do not specify mount
89 options explicitly.
90 The
91 .Nm
92 command is usually run without arguments.
93 It compares the entries
94 .Pa /etc/auto_master
95 with the current list of
96 .Nm autofs
97 mounts in
98 .Pa /etc/mnttab
99 and adds, removes or updates
100 .Nm autofs
101 mounts to bring the
102 .Pa /etc/mnttab
103 up to date with the
104 .Pa /etc/auto_master .
105 At boot time it installs all
106 .Nm autofs
107 mounts from the master map.
108 Subsequently, it may be run to install
109 .Nm autofs
110 mounts for new entries in the master map or the direct map, or to perform
111 unmounts for entries that have been removed from these maps.
112 .Ss Automount with Solaris Trusted Extensions
113 If a system is configured with Solaris Trusted Extensions, additional
114 processing is performed to facilitate multilevel home directory access.
115 A list of zones whose labels are dominated by the current zone is generated and
116 default
117 .Sy auto_home
118 automount maps are generated if they do not currently exist.
119 These automount maps are named
120 .Sy auto_home_ Ns Ar zonename ,
121 where
122 .Ar zonename
123 is the name of each zone's lower-level zone.
125 .Nm autofs
126 mount of each such
127 .Sy auto_home
128 map is then performed, regardless of whether it is explicitly or implicitly
129 listed in the master map.
130 Instead of
131 .Nm autofs
132 mounting the standard
133 .Sy auto_home
134 map, the zone uses an
135 .Pa auto_home
136 file appended with its own zone name.
137 Each zone's
138 .Sy auto_home
139 map is uniquely named so that it can be maintained and shared by all zones using
140 a common name server.
142 By default, the home directories of lower-level zones are mounted read-only
143 under
144 .Pa /zone/ Ns Ar zonename Ns Pa /export/home
145 when each zone is booted.
146 The default
147 .Sy auto_home_ Ns Ar zonename
148 automount map specifies that path as the source directory for an
149 .Nm lofs
150 remount onto
151 .Pa /zone/ Ns Ar zonename Ns Pa /home/ Ns Ar username .
152 For example, the file
153 .Pa auto_home_public ,
154 as generated from a higher level zone would contain:
155 .Bd -literal -offset indent
156 +auto_home_public
157 *       -fstype=lofs    :/zone/public/export/home/&
160 When a home directory is referenced and the name does not match any other keys
161 in the
162 .Sy auto_home_public
163 map, it will match this loopback mount specification.
164 If this loopback match occurs and the name corresponds to a valid user whose
165 home directory does not exist in the public zone, the directory is automatically
166 created on behalf of the user.
167 .Sh OPTIONS
168 The following options are supported:
169 .Bl -tag -width Ds
170 .It Fl v
171 Verbose mode.
172 Notifies of
173 .Nm autofs
174 mounts, unmounts, or other non-essential information.
175 .It Fl t Ar duration
176 Specifies a
177 .Ar duration ,
178 in seconds, that a file system is to remain mounted when not in use.
179 The default is
180 .Sy 10
181 minutes.
183 .Sh USAGE
184 .Ss Map Entry Format
185 A simple map entry
186 .Pq mapping
187 takes the form:
188 .Bd -literal -offset indent
189 .Ar key Oo Fl Ns Ar mount-options Oc Ar location Ns ...
192 where
193 .Ar key
194 is the full pathname of the directory to mount when used in a direct map, or the
195 simple name of a subdirectory in an indirect map.
196 .Ar mount-options
197 is a comma-separated list of
198 .Nm mount
199 options, and
200 .Ar location
201 specifies a file system from which the directory may be mounted.
202 In the case of a simple NFS mount, the options that can be used are specified in
203 .Xr mount_nfs 1M ,
205 .Ar location
206 takes the form:
208 .Dl Ar host Ns \&: Ns Ar pathname
210 .Ar host
211 is the name of the host from which to mount the file system, and
212 .Ar pathname
213 is the absolute pathname of the directory to mount.
215 Options to other file systems are documented in the other
216 .Nm mount_*
217 reference manual pages.
218 .Ss Replicated File Systems
219 Multiple
220 .Ar location
221 fields can be specified for replicated NFS file systems, in which case
223 and the kernel will each try to use that information to increase availability.
224 If the read-only flag is set in the map entry,
225 .Nm automountd
226 mounts a list of locations that the kernel may use, sorted by several criteria.
227 Only locations available at mount time will be mounted, and thus be available to
228 the kernel.
229 When a server does not respond, the kernel will switch to an alternate server.
230 The sort ordering of
232 is used to determine how the next server is chosen.
233 If the read-only flag is not set,
235 will mount the best single location, chosen by the same sort ordering, and new
236 servers will only be chosen when an unmount has been possible, and a remount is
237 done.
238 Servers on the same local subnet are given the strongest preference, and servers
239 on the local net are given the second strongest preference.
240 Among servers equally far away, response times will determine the order if no
241 weighting factors
242 .Pq see below
243 are used.
245 If the list includes server locations using both the NFS Version 2 Protocol and
246 the NFS Version 3 Protocol,
248 will choose only a subset of the server locations on the list, so that all
249 entries will be the same protocol.
250 It will choose servers with the NFS Version 3 Protocol so long as an NFS Version
251 2 Protocol server on a local subnet will not be ignored.
252 See the FIXME for additional details.
254 If each
255 .Ar location
256 in the list shares the same
257 .Ar pathname
258 then a single
259 .Ar location
260 may be used with a comma-separated list of hostnames:
261 .Bd -literal -offset indent
262 .Ar hostname Ns \&, Ns Ar hostname Ns ...: Ns Ar pathname
265 Requests for a server may be weighted, with the weighting factor appended to
266 the server name as an integer in parentheses.
267 Servers without a weighting are assumed to have a value of zero
268 .Pq most likely to be selected .
269 Progressively higher values decrease the chance of being selected.
270 In the example,
271 .Bd -literal -offset indent
272 man -ro alpha,bravo,charlie(1),delta(4):/usr/man
275 hosts
276 .Sy alpha
278 .Sy bravo
279 have the highest priority; host
280 .Sy delta
281 has the lowest.
283 Server proximity takes priority in the selection process.
284 In the example above, if the server
285 .Sy delta
286 is on the same network segment as the client, but the others are on different
287 network segments, then
288 .Sy delta
289 will be selected; the weighting value is ignored.
290 The weighting has effect only when selecting between servers with the same
291 network proximity.
292 The automounter always selects the localhost over other servers on the same
293 network segment, regardless of weighting.
295 In cases where each server has a different export point, the weighting can
296 still be applied.
297 For example:
298 .Bd -literal -offset indent
299 man     -ro     alpha:/usr/man bravo,charlie(1):/usr/share/man \e
300                 delta(3):/export/man
303 A mapping can be continued across input lines by escaping the NEWLINE with a
304 backslash
305 .Pq Qq Sy \e .
306 Comments begin with a number sign
307 .Pq Qq Sy #
308 and end at the subsequent NEWLINE.
309 .Ss Map Key Substitution
310 The ampersand
311 .Pq Qq Sy \*(Am
312 character is expanded to the value of the
313 .Ar key
314 field for the entry in which it occurs.
315 In this case:
316 .Bd -literal -offset indent
317 jane    sparcserver:/home/&
321 .Sy \*(Am
322 expands to
323 .Sy jane .
324 .Ss Wildcard Key
325 The asterisk
326 .Pq Qq Sy *
327 character, when supplied as the
328 .Ar key
329 field, is recognized as the catch-all entry.
330 Such an entry will match any key not previously matched.
331 For instance, if the following entry appeared in the indirect map for
332 .Pa /config :
333 .Bd -literal -offset indent
334 *       &:/export/config/&
337 this would allow automatic mounts in
338 .Pa /config
339 of any remote file system whose location could be specified as:
340 .Bd -literal -offset indent
341 .Ar hostname Ns \&: Ns Pa /export/config/ Ns Ar hostname
344 Note that the wildcard key does not work in conjunction with the
345 .Fl browse
346 option.
347 .Ss Variable Substitution
348 Client specific variables can be used within an
350 map.
351 For instance, if
352 .Sy $HOST
353 appeared within a map,
355 would expand it to its current value for the client's host name.
356 Supported variables are:
357 .Bl -column "PLATFORM" "arch -k or uname -m"
358 .It Sy NAME Ta Sy OUTPUT OF Ta Sy DESCRIPTION (EXAMPLE)
359 .It Ev ARCH Ta Nm arch Ta architecture name Pq Qq Sy sun4
360 .It Ev CPU Ta Nm uname Fl p Ta processor type Pq Qq Sy sparc
361 .It Ev HOST Ta Nm uname Fl n Ta host name Pq Qq Sy myhost
362 .It Ev KARCH Ta Nm arch Fl k No or Nm uname Fl m Ta kernel architecture name or
363 machine hardware name
364 .Pq Qq Sy sun4u
365 .It Ev OSNAME Ta Nm uname Fl s Ta OS name Pq Qq Sy SunOS
366 .It Ev OSREL Ta Nm name Fl r Ta OS release name Pq Qq Sy 5.3
367 .It Ev OSVERS Ta Nm uname Fl v Ta OS version Pq Qq Sy beta1.0
368 .It Ev NATISA Ta Nm isainfo Fl n Ta native instruction set architecture for the
369 system
370 .Pq Qq Sy sparcv9
371 .It Ev PLATFORM Ta Nm uname Fl i Ta platform name Pq Qq Sy SUNW,Sun-Fire-V240
374 If a reference needs to be protected from affixed characters, you can surround
375 the variable name with curly braces
376 .Pq Qq Sy \(lC Ns Sy \(rC .
377 .Ss Multiple Mounts
378 A multiple mount entry takes the form:
379 .Bd -literal -offset indent
380 .Ar key Oo Fl Ns Ar mount-options Oc Oo Oo Ar mountpoint Oc
381 .Oo Fl Ns Ar mount-options Oc  Ar location Ns ... Oc Ns ...
384 The initial
385 .Ar mountpoint
386 is optional for the first mount and mandatory for all subsequent mounts.
387 The optional
388 .Ar mountpoint
389 is taken as a pathname relative to the directory named by
390 .Ar key .
392 .Ar mountpoint
393 is omitted in the first occurrence, a
394 .Ar mountpoint
396 .Pa /
397 .Pq root
398 is implied.
400 Given an entry in the indirect map for
401 .Pa /src :
402 .Bd -literal -offset indent
403 beta    -ro \e
404         /               svr1,svr2:/export/src/beta  \e
405         /1.0            svr1,svr2:/export/src/beta/1.0 \e
406         /1.0/man        svr1,svr2:/export/src/beta/1.0/man
409 All offsets must exist on the server under
410 .Sy beta .
412 will automatically mount
413 .Pa /src/beta ,
414 .Pa /src/beta/1.0 ,
416 .Pa /src/beta/1.0/man ,
417 as needed, from either
418 .Sy svr1
420 .Sy svr2 ,
421 whichever host is nearest and responds first.
422 .Ss Other File System Types
423 The automounter assumes NFS mounts as a default file system type.
424 Other file system types can be described using the
425 .Sy fstype
426 mount option.
427 Other mount options specific to this file system type can be combined with the
428 .Sy fstype
429 option.
430 The location field must contain information specific to the file system type.
431 If the location field begins with a slash, a colon character must be prepended,
432 for instance, to mount a CD file system:
433 .Bd -literal -offset indent
434 cdrom   -fstype=hsfs,ro :/dev/sr0
437 or to perform an
438 .Nm autofs
439 mount:
440 .Bd -literal -offset indent
441 src     -fstype=autofs  auto_src
444 Use this procedure only if you are not using Volume Manager.
446 See the
447 .Sx NOTES
448 section for information on option inheritance.
449 .Ss Indirect Maps
450 An indirect map allows you to specify mappings for the subdirectories you wish
451 to mount under the
452 .Ar directory
453 indicated on the command line.
454 In an indirect map, each
455 .Ar key
456 consists of a simple name that refers to one or more file systems that are to be
457 mounted as needed.
458 .Ss Direct Maps
459 Entries in a direct map are associated directly with
460 .Nm autofs
461 mount points.
462 Each
463 .Ar key
464 is the full pathname of an
465 .Nm autofs
466 mount point.
467 The direct map as a whole is not associated with any single directory.
469 Direct maps are distinguished from indirect maps by the
470 .Sy \-
471 key.
472 For example:
473 .Bd -literal -offset indent
474 # Master map for automounter
476 +auto_master
477 /net    -hosts          -nosuid,nobrowse
478 /home   auto_home       -nobrowse
479 /-      auto_direct
481 .Ss Included Maps
482 The contents of another map can be included within a map with an entry of the
483 form
484 .Bd -literal -offset indent
485 .No + Ns Ar mapname
489 .Ar mapname
490 begins with a slash, it is assumed to be the pathname of a local file.
491 Otherwise, the location of the map is determined by the policy of the name
492 service switch according to the entry for the automounter in
493 .Pa /etc/nsswitch.conf ,
494 such as
495 .Bd -literal -offset indent
496 automount: files nis
499 If the name service is
500 .Sy files ,
501 then the name is assumed to be that of a local file in
502 .Pa /etc .
503 If the key being searched for is not found in the included map, the search
504 continues with the next entry.
505 .Ss Special Maps
506 There are two special maps available:
507 .Sy -hosts
509 .Sy -null .
511 .Sy -hosts
512 map is used with the
513 .Pa /net
514 directory and assumes that the map key is the hostname of an NFS server.
516 .Nm automountd
517 daemon dynamically constructs a map entry from the server's list of exported
518 file systems.
519 References to a directory under
520 .Pa /net/hermes
521 will refer to the corresponding directory relative to
522 .Sy hermes
523 root.
526 .Sy -null
527 map cancels a previous map for the directory indicated.
528 This is most useful in the
529 .Pa /etc/auto_master
530 for cancelling entries that would otherwise be inherited from the
531 .Sy +auto_master
532 include entry.
533 To be effective, the
534 .Sy -null
535 entries must be inserted before the included map entry.
536 .Ss Executable Maps
537 Local maps that have the execute bit set in their file permissions will be
538 executed by the automounter and provided with a key to be looked up as an
539 argument.
540 The executable map is expected to return the content of an automounter map entry
541 on its stdout or no output if the entry cannot be determined.
542 A direct map cannot be made executable.
543 .Ss Configuration and the auto_master Map
544 When initiated without arguments,
546 consults the master map for a list of
547 .Nm autofs
548 mount points and their maps.
549 It mounts any
550 .Nm autofs
551 mounts that are not already mounted, and unmounts
552 .Nm autofs
553 mounts that have been removed from the master map or direct map.
555 The master map is assumed to be called
556 .Sy auto_master
557 and its location is determined by the name service switch policy.
558 Normally the master map is located initially as a local file
559 .Pa /etc/auto_master .
560 .Ss Browsing
562 .Nm automountd
563 daemon supports browsability of indirect maps.
564 This allows all of the potential mount points to be visible, whether or not they
565 are mounted.
567 .Sy -nobrowse
568 option can be added to any indirect
569 .Nm autofs
570 map to disable browsing.
571 For example:
572 .Bd -literal -offset indent
573 /net    -hosts          -nosuid,nobrowse
574 /home   auto_home
577 In this case, any
578 .Ar hostname Ns s
579 would only be visible in
580 .Pa /net
581 after they are mounted, but all potential mount points would be visible under
582 .Pa /home .
584 .Sy -browse
585 option enables browsability of
586 .Nm autofs
587 file systems.
588 This is the default for all indirect maps.
591 .Sy -browse
592 option does not work in conjunction with the wildcard key.
593 .Ss Restricting Mount Maps
594 Options specified for a map are used as the default options for all the entries
595 in that map.
596 They are ignored when map entries specify their own mount options.
598 In some cases, however, it is desirable to force
599 .Sy nosuid , nodevices , nosetuid ,
601 .Sy noexec
602 for a complete mount map and its submounts.
603 This can be done by specifying the additional mount option,
604 .Sy -restrict .
605 .Bd -literal -offset indent
606 /home   auto_home       -restrict,nosuid,hard
610 .Sy -restrict
611 option forces the inheritance of all the restrictive options
612 .Sy nosuid , nodevices , nosetuid ,
614 .Sy noexec
615 as well as the restrict option itself.
616 In this particular example, the
617 .Sy nosuid
619 .Sy restrict
620 option are inherited but the
621 .Sy hard
622 option is not.
624 .Sy restrict
625 option also prevents the execution of
626 .Qq executable maps
627 and is enforced for auto mounts established by programs with fewer than all
628 privileges available in their zone.
629 .Sh FILES
630 .Bl -tag -width Ds
631 .It Pa /etc/auto_master
632 Master automount map.
633 .It Pa /etc/auto_home
634 Map to support automounted home directories.
635 .It Pa /etc/nsswitch.conf
636 Name service switch configuration file.
638 .Xr nsswitch.conf 4 .
640 .Sh EXIT STATUS
641 .Ex -std
642 .Sh SEE ALSO
643 .Xr isainfo 1 ,
644 .Xr ls 1 ,
645 .Xr svcs 1 ,
646 .Xr uname 1 ,
647 .Xr automountd 1M ,
648 .Xr mount 1M ,
649 .Xr mount_nfs 1M ,
650 .Xr svcadm 1M ,
651 .Xr autofs 4 ,
652 .Xr attributes 5 ,
653 .Xr nfssec 5 ,
654 .Xr smf 5
655 .Sh NOTES
656 .Nm autofs
657 mount points must not be hierarchically related.
659 does not allow an
660 .Nm autofs
661 mount point to be created within another
662 .Nm autofs
663 mount.
665 Since each direct map entry results in a new
666 .Nm autofs
667 mount such maps should be kept short.
669 Entries in both direct and indirect maps can be modified at any time.
670 The new information is used when
671 .Nm automountd
672 next uses the map entry to do a mount.
674 New entries added to a master map or direct map will not be useful until the
675 automount command is run to install them as new
676 .Nm autofs
677 mount points.
678 New entries added to an indirect map may be used immediately.
680 As of the Solaris 2.6 release, a listing
681 .Po see
682 .Xr ls 1
684 of the
685 .Nm autofs
686 directory associated with an indirect map shows all potential mountable
687 entries.
688 The attributes associated with the potential mountable entries are temporary.
689 The real file system attributes will only be shown once the file system has been
690 mounted.
692 Default mount options can be assigned to an entire map when specified as an
693 optional third field in the master map.
694 These options apply only to map entries that have no mount options.
695 Note that map entities with options override the default options, as at this
696 time, the options do not concatenate.
697 The concatenation feature is planned for a future release.
699 When operating on a map that invokes an NFS mount, the default number of
700 retries for the automounter is 0, that is, a single mount attempt, with no
701 retries.
702 Note that this is significantly different from the default
703 .Pq 10000
704 for the
705 .Xr mount_nfs 1M
706 utility.
708 The Network Information Service
709 .Pq NIS
710 was formerly known as Sun Yellow Pages
711 .Pq YP .
712 The functionality of the two remains the same.
716 service is managed by the service management facility,
717 .Xr smf 5 ,
718 under the service identifier:
719 .Bd -literal -offset indent
720 svc:/system/filesystem/autofs:default
723 Administrative actions on this service, such as enabling, disabling, or
724 requesting restart, can be performed using
725 .Xr svcadm 1M .
726 The service's status can be queried using the
727 .Xr svcs 1
728 command.