1 AUTOMOUNT(1M) Maintenance Commands AUTOMOUNT(1M) 2 3 4 5 NAME 6 automount - install automatic mount points 7 8 SYNOPSIS 9 /usr/sbin/automount [-t duration] [-v] 10 11 12 DESCRIPTION 13 The automount utility installs autofs mount points and associates an 14 automount map with each mount point. It starts the automountd(1M) 15 daemon if it finds any non-trivial entries in either local or 16 distributed automount maps and if the daemon is not already running. 17 The autofs file system monitors attempts to access directories within 18 it and notifies the automountd(1M) daemon. The daemon uses the map to 19 locate a file system, which it then mounts at the point of reference 20 within the autofs file system. A map can be assigned to an autofs mount 21 using an entry in the /etc/auto_master map or a direct map. 22 23 24 If the file system is not accessed within an appropriate interval (10 25 minutes by default), the automountd daemon unmounts the file system. 26 27 28 The file /etc/auto_master determines the locations of all autofs mount 29 points. By default, this file contains three entries: 30 31 # Master map for automounter 32 # 33 +auto_master 34 /net -hosts -nosuid 35 /home auto_home 36 37 38 39 40 The +auto_master entry is a reference to an external NIS or NIS+ master 41 map. If one exists, then its entries are read as if they occurred in 42 place of the +auto_master entry. The remaining entries in the master 43 file specify a directory on which an autofs mount will be made followed 44 by the automounter map to be associated with it. Optional mount options 45 may be supplied as an optional third field in the each entry. These 46 options are used for any entries in the map that do not specify mount 47 options explicitly. The automount command is usually run without 48 arguments. It compares the entries /etc/auto_master with the current 49 list of autofs mounts in /etc/mnttab and adds, removes or updates 50 autofs mounts to bring the /etc/mnttab up to date with the 51 /etc/auto_master. At boot time it installs all autofs mounts from the 52 master map. Subsequently, it may be run to install autofs mounts for 53 new entries in the master map or the direct map, or to perform unmounts 54 for entries that have been removed from these maps. 55 56 Automount with Solaris Trusted Extensions 57 If a system is configured with Solaris Trusted Extensions, additional 58 processing is performed to facilitate multilevel home directory access. 59 A list of zones whose labels are dominated by the current zone is 60 generated and default auto_home automount maps are generated if they do 61 not currently exist. These automount maps are named 62 auto_home_<zonename>, where <zonename> is the name of each zone's 63 lower-level zone. An autofs mount of each such auto_home map is then 64 performed, regardless of whether it is explicitly or implicitly listed 65 in the master map. Instead of autofs mounting the standard auto_home 66 map, the zone uses an auto_home file appended with its own zone name. 67 Each zone's auto_home map is uniquely named so that it can be 68 maintained and shared by all zones using a common name server. 69 70 71 By default, the home directories of lower-level zones are mounted read- 72 only under /zone/<zonename>/export/home when each zone is booted. The 73 default auto_home_<zonename> automount map specifies that path as the 74 source directory for an lofs remount onto 75 /zone/<zonename>/home/<username>. For example, the file 76 auto_home_public, as generated from a higher level zone would contain: 77 78 79 +auto_home_public 80 81 82 * -fstype=lofs :/zone/public/export/home/& 83 84 85 When a home directory is referenced and the name does not match any 86 other keys in the auto_home_public map, it will match this loopback 87 mount specification. If this loopback match occurs and the name 88 corresponds to a valid user whose home directory does not exist in the 89 public zone, the directory is automatically created on behalf of the 90 user. 91 92 OPTIONS 93 The following options are supported: 94 95 -t duration 96 Specifies a duration, in seconds, that a file system is 97 to remain mounted when not in use. The default is 10 98 minutes. 99 100 101 -v 102 Verbose mode. Notifies of autofs mounts, unmounts, or 103 other non-essential information. 104 105 106 USAGE 107 Map Entry Format 108 A simple map entry (mapping) takes the form: 109 110 key [ -mount-options ] location ... 111 112 113 114 115 where key is the full pathname of the directory to mount when used in a 116 direct map, or the simple name of a subdirectory in an indirect map. 117 mount-options is a comma-separated list of mount options, and location 118 specifies a file system from which the directory may be mounted. In 119 the case of a simple NFS mount, the options that can be used are 120 specified in mount_nfs(1M), and location takes the form: 121 122 host:pathname 123 124 125 126 127 host is the name of the host from which to mount the file system, and 128 pathname is the absolute pathname of the directory to mount. 129 130 131 Options to other file systems are documented in the other mount_* 132 reference manual pages. 133 134 Replicated File Systems 135 Multiple location fields can be specified for replicated NFS file 136 systems, in which case automount and the kernel will each try to use 137 that information to increase availability. If the read-only flag is set 138 in the map entry, automountd mounts a list of locations that the kernel 139 may use, sorted by several criteria. Only locations available at mount 140 time will be mounted, and thus be available to the kernel. When a 141 server does not respond, the kernel will switch to an alternate server. 142 The sort ordering of automount is used to determine how the next server 143 is chosen. If the read-only flag is not set, automount will mount the 144 best single location, chosen by the same sort ordering, and new servers 145 will only be chosen when an unmount has been possible, and a remount is 146 done. Servers on the same local subnet are given the strongest 147 preference, and servers on the local net are given the second strongest 148 preference. Among servers equally far away, response times will 149 determine the order if no weighting factors (see below) are used. 150 151 152 If the list includes server locations using both the NFS Version 2 153 Protocol and the NFS Version 3 Protocol, automount will choose only a 154 subset of the server locations on the list, so that all entries will be 155 the same protocol. It will choose servers with the NFS Version 3 156 Protocol so long as an NFS Version 2 Protocol server on a local subnet 157 will not be ignored. See the for additional details. 158 159 160 If each location in the list shares the same pathname then a single 161 location may be used with a comma-separated list of hostnames: 162 163 hostname,hostname...:pathname 164 165 166 167 168 Requests for a server may be weighted, with the weighting factor 169 appended to the server name as an integer in parentheses. Servers 170 without a weighting are assumed to have a value of zero (most likely to 171 be selected). Progressively higher values decrease the chance of being 172 selected. In the example, 173 174 man -ro alpha,bravo,charlie(1),delta(4):/usr/man 175 176 177 178 179 hosts alpha and bravo have the highest priority; host delta has the 180 lowest. 181 182 183 Server proximity takes priority in the selection process. In the 184 example above, if the server delta is on the same network segment as 185 the client, but the others are on different network segments, then 186 delta will be selected; the weighting value is ignored. The weighting 187 has effect only when selecting between servers with the same network 188 proximity. The automounter always selects the localhost over other 189 servers on the same network segment, regardless of weighting. 190 191 192 In cases where each server has a different export point, the weighting 193 can still be applied. For example: 194 195 man -ro alpha:/usr/man bravo,charlie(1):/usr/share/man 196 delta(3):/export/man 197 198 199 200 201 A mapping can be continued across input lines by escaping the NEWLINE 202 with a backslash (\) Comments begin with a number sign (#) and end at 203 the subsequent NEWLINE. 204 205 Map Key Substitution 206 The ampersand (&) character is expanded to the value of the key field 207 for the entry in which it occurs. In this case: 208 209 jane sparcserver:/home/& 210 211 212 213 214 the & expands to jane. 215 216 Wildcard Key 217 The asterisk (*) character, when supplied as the key field, is 218 recognized as the catch-all entry. Such an entry will match any key not 219 previously matched. For instance, if the following entry appeared in 220 the indirect map for /config: 221 222 * &:/export/config/& 223 224 225 226 227 this would allow automatic mounts in /config of any remote file system 228 whose location could be specified as: 229 230 hostname:/export/config/hostname 231 232 233 234 235 Note that the wildcard key does not work in conjunction with the -browse 236 option. 237 238 Variable Substitution 239 Client specific variables can be used within an automount map. For 240 instance, if $HOST appeared within a map, automount would expand it to 241 its current value for the client's host name. Supported variables are: 242 243 244 245 246 ARCH The output of arch The architecture name. For example, sun4 on a sun4u machine. 247 CPU The output of uname -p The processor type. 248 For example, "sparc" 249 HOST The output of uname -n The host name. 250 For example, myhost. 251 KARCH The output of arch -k or uname -m The kernel architecture name or machine hardware name. For example, sun4u. 252 253 OSNAME The output of uname -s The OS name. 254 For example, "SunOS" 255 OSREL The output of uname -r The OS release name. 256 For example "5.3" 257 OSVERS The output of uname -v The OS version. 258 For example, "beta1.0" 259 NATISA The output of isainfo -n The native instruction set architecture for the system. 260 For example, "sparcv9" 261 PLATFORM The output of uname -i The platform name. For example, SUNW,Sun-Fire-V240. 262 263 264 265 266 If a reference needs to be protected from affixed characters, you can 267 surround the variable name with curly braces ({}). 268 269 Multiple Mounts 270 A multiple mount entry takes the form: 271 272 key [-mount-options] [[mountpoint] [-mount-options] location...]... 273 274 275 276 277 The initial /[mountpoint] is optional for the first mount and mandatory 278 for all subsequent mounts. The optional mountpoint is taken as a 279 pathname relative to the directory named by key. If mountpoint is 280 omitted in the first occurrence, a mountpoint of / (root) is implied. 281 282 283 Given an entry in the indirect map for /src 284 285 beta -ro\ 286 / svr1,svr2:/export/src/beta \ 287 /1.0 svr1,svr2:/export/src/beta/1.0 \ 288 /1.0/man svr1,svr2:/export/src/beta/1.0/man 289 290 291 292 293 All offsets must exist on the server under beta. automount will 294 automatically mount /src/beta, /src/beta/1.0, and /src/beta/1.0/man, as 295 needed, from either svr1 or svr2, whichever host is nearest and 296 responds first. 297 298 Other File System Types 299 The automounter assumes NFS mounts as a default file system type. Other 300 file system types can be described using the fstype mount option. Other 301 mount options specific to this file system type can be combined with 302 the fstype option. The location field must contain information specific 303 to the file system type. If the location field begins with a slash, a 304 colon character must be prepended, for instance, to mount a CD file 305 system: 306 307 cdrom -fstype=hsfs,ro :/dev/sr0 308 309 310 311 312 or to perform an autofs mount: 313 314 src -fstype=autofs auto_src 315 316 317 318 319 Use this procedure only if you are not using Volume Manager. 320 321 322 See the NOTES section for information on option inheritance. 323 324 Indirect Maps 325 An indirect map allows you to specify mappings for the subdirectories 326 you wish to mount under the directory indicated on the command line. In 327 an indirect map, each key consists of a simple name that refers to one 328 or more file systems that are to be mounted as needed. 329 330 Direct Maps 331 Entries in a direct map are associated directly with autofs mount 332 points. Each key is the full pathname of an autofs mount point. The 333 direct map as a whole is not associated with any single directory. 334 335 336 Direct maps are distinguished from indirect maps by the /- key. For 337 example: 338 339 # Master map for automounter 340 # 341 +auto_master 342 /net -hosts -nosuid,nobrowse 343 /home auto_home -nobrowse 344 /- auto_direct 345 346 347 348 Included Maps 349 The contents of another map can be included within a map with an entry 350 of the form 351 352 +mapname 353 354 355 356 357 If mapname begins with a slash, it is assumed to be the pathname of a 358 local file. Otherwise, the location of the map is determined by the 359 policy of the name service switch according to the entry for the 360 automounter in /etc/nsswitch.conf, such as 361 362 automount: files nis 363 364 365 366 367 If the name service is files, then the name is assumed to be that of a 368 local file in /etc. If the key being searched for is not found in the 369 included map, the search continues with the next entry. 370 371 Special Maps 372 There are two special maps available: -hosts and -null. The -hosts map is 373 used with the /net directory and assumes that the map key is the 374 hostname of an NFS server. The automountd daemon dynamically constructs 375 a map entry from the server's list of exported file systems. References 376 to a directory under /net/hermes will refer to the corresponding 377 directory relative to hermes root. 378 379 380 The -null map cancels a previous map for the directory indicated. This 381 is most useful in the /etc/auto_master for cancelling entries that 382 would otherwise be inherited from the +auto_master include entry. To be 383 effective, the -null entries must be inserted before the included map 384 entry. 385 386 Executable Maps 387 Local maps that have the execute bit set in their file permissions will 388 be executed by the automounter and provided with a key to be looked up 389 as an argument. The executable map is expected to return the content of 390 an automounter map entry on its stdout or no output if the entry cannot 391 be determined. A direct map cannot be made executable. 392 393 Configuration and the auto_master Map 394 When initiated without arguments, automount consults the master map for 395 a list of autofs mount points and their maps. It mounts any autofs 396 mounts that are not already mounted, and unmounts autofs mounts that 397 have been removed from the master map or direct map. 398 399 400 The master map is assumed to be called auto_master and its location is 401 determined by the name service switch policy. Normally the master map 402 is located initially as a local file /etc/auto_master. 403 404 Browsing 405 The automount daemon supports browsability of indirect maps. This 406 allows all of the potential mount points to be visible, whether or not 407 they are mounted. The -nobrowse option can be added to any indirect 408 autofs map to disable browsing. For example: 409 410 /net -hosts -nosuid,nobrowse 411 /home auto_home 412 413 414 415 416 In this case, any hostnames would only be visible in /net after they 417 are mounted, but all potential mount points would be visible under 418 /home. The -browse option enables browsability of autofs file systems. 419 This is the default for all indirect maps. 420 421 422 The -browse option does not work in conjunction with the wildcard key. 423 424 Restricting Mount Maps 425 Options specified for a map are used as the default options for all the 426 entries in that map. They are ignored when map entries specify their 427 own mount options. 428 429 430 In some cases, however, it is desirable to force nosuid, nodevices, 431 nosetuid, or noexec for a complete mount map and its submounts. This 432 can be done by specifying the additional mount option, -restrict. 433 434 /home auto_home -restrict,nosuid,hard 435 436 437 438 439 The -restrict option forces the inheritance of all the restrictive 440 options nosuid, nodevices, nosetuid, and noexec as well as the restrict 441 option itself. In this particular example, the nosuid and restrict 442 option are inherited but the hard option is not. The restrict option 443 also prevents the execution of "executable maps" and is enforced for 444 auto mounts established by programs with fewer than all privileges 445 available in their zone. 446 447 EXIT STATUS 448 The following exit values are returned: 449 450 0 451 Successful completion. 452 453 454 1 455 An error occurred. 456 457 458 FILES 459 /etc/auto_master 460 Master automount map. 461 462 463 /etc/auto_home 464 Map to support automounted home directories. 465 466 467 /etc/default/autofs 468 Supplies default values for parameters for 469 automount and automountd. See autofs(4). 470 471 472 /etc/nsswitch.conf 473 Name service switch configuration file. See 474 nsswitch.conf(4). 475 476 477 SEE ALSO 478 isainfo(1), ls(1), svcs(1), uname(1), automountd(1M), mount(1M), 479 mount_nfs(1M), svcadm(1M), autofs(4), attributes(5), nfssec(5), smf(5) 480 481 482 483 NOTES 484 autofs mount points must not be hierarchically related. automount does 485 not allow an autofs mount point to be created within another autofs 486 mount. 487 488 489 Since each direct map entry results in a new autofs mount such maps 490 should be kept short. 491 492 493 Entries in both direct and indirect maps can be modified at any time. 494 The new information is used when automountd next uses the map entry to 495 do a mount. 496 497 498 New entries added to a master map or direct map will not be useful 499 until the automount command is run to install them as new autofs mount 500 points. New entries added to an indirect map may be used immediately. 501 502 503 As of the Solaris 2.6 release, a listing (see ls(1)) of the autofs 504 directory associated with an indirect map shows all potential mountable 505 entries. The attributes associated with the potential mountable entries 506 are temporary. The real file system attributes will only be shown once 507 the file system has been mounted. 508 509 510 Default mount options can be assigned to an entire map when specified 511 as an optional third field in the master map. These options apply only 512 to map entries that have no mount options. Note that map entities with 513 options override the default options, as at this time, the options do 514 not concatenate. The concatenation feature is planned for a future 515 release. 516 517 518 When operating on a map that invokes an NFS mount, the default number 519 of retries for the automounter is 0, that is, a single mount attempt, 520 with no retries. Note that this is significantly different from the 521 default (10000) for the mount_nfs(1M) utility. 522 523 524 The Network Information Service (NIS) was formerly known as Sun Yellow 525 Pages (YP). The functionality of the two remains the same. 526 527 528 The automount service is managed by the service management facility, 529 smf(5), under the service identifier: 530 531 svc:/system/filesystem/autofs:default 532 533 534 535 536 Administrative actions on this service, such as enabling, disabling, or 537 requesting restart, can be performed using svcadm(1M). The service's 538 status can be queried using the svcs(1) command. 539 540 541 542 September 8, 2015 AUTOMOUNT(1M)