1 .\"
   2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
   3 .\" Portions Copyright 1994-2008 The FreeBSD Project. All rights reserved.
   4 .\" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
   5 .\" the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.THIS SOFTWARE IS PROVIDED
   6 .\" BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   7 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
   8 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   9 .\" Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  10 .Dd March 4, 2018
  11 .Dt MOUNT_SMBFS 1M
  12 .Os
  13 .Sh NAME
  14 .Nm mount_smbfs ,
  15 .Nm umount_smbfs
  16 .Nd mount and unmount a shared resource from an SMB file server
  17 .Sh SYNOPSIS
  18 .Nm mount
  19 .Op Fl F Cm smbfs
  20 .Op Ar generic-options
  21 .Op Fl o Ar name Ns Oo = Ns Ar value Oc
  22 .Op Fl O
  23 .Ar resource
  24 .Nm mount
  25 .Op Fl F Cm smbfs
  26 .Op Ar generic-options
  27 .Op Fl o Ar name Ns Oo = Ns Ar value Oc
  28 .Op Fl O
  29 .Ar mount-point
  30 .Nm mount
  31 .Op Fl F Cm smbfs
  32 .Op Ar generic-options
  33 .Op Fl o Ar name Ns Oo = Ns Ar value Oc
  34 .Op Fl O
  35 .Ar resource mount-point
  36 .Nm umount
  37 .Op Fl F Cm smbfs
  38 .Op Ar generic-options
  39 .Ar mount-point
  40 .Sh DESCRIPTION
  41 .sp
  42 .LP
  43 The \fBmount\fR utility attaches a named resource, \fIresource\fR, to the file
  44 system hierarchy at the path name location, \fImount-point\fR, which must
  45 already exist.
  46 .sp
  47 .LP
  48 The
  49 .Nm mount
  50 utility attaches a named resource,
  51 .Ar resource ,
  52 to the file system hierarchy at the path name location,
  53 .Ar mount-point ,
  54 which must already exist.
  55 .Pp
  56 If
  57 .Ar mount-point
  58 has any contents prior to the
  59 .Nm mount
  60 operation, those contents remain hidden until the resource is unmounted.
  61 An authorized user with the
  62 .Dv SYS_MOUNT
  63 privilege can perform a
  64 .Nm mount
  65 operation.
  66 Also, a user can perform SMBFS mount operations on a directory the user owns.
  67 .Pp
  68 If the resource is listed in the
  69 .Pa /etc/vfstab
  70 file, you can specify either
  71 .Ar resource
  72 or
  73 .Ar mount-point
  74 as the
  75 .Nm mount
  76 command will consult the
  77 .Pa /etc/vfstab
  78 file for more information.
  79 If the
  80 .Fl F
  81 option is omitted,
  82 .Nm mount
  83 takes the file system type from the entry in the
  84 .Pa /etc/vfstab
  85 file.
  86 .Pp
  87 If the resource is not listed in the
  88 .Pa /etc/vfstab
  89 file, the command line must specify both
  90 .Ar resource
  91 and
  92 .Ar mount-point .
  93 .Pp
  94 The
  95 .Nm umount
  96 utility detaches a mounted file system from the file system hierarchy.
  97 An authorized user with the
  98 .Dv SYS_MOUNT
  99 privilege can perform a
 100 .Nm umount
 101 operation.
 102 Also, a user can perform SMBFS unmount operations on a directory the user owns.
 103 .Pp
 104 The
 105 .Em network/smb/client
 106 service must be enabled to successfully mount an SMB share.
 107 This service is enabled, by default.
 108 .Pp
 109 To enable the service, enter the following
 110 .Xr svcadm 1M
 111 command:
 112 .Bd -literal
 113 # svcadm enable network/smb/client
 114 .Ed
 115 .Ss Operands
 116 The
 117 .Nm mount
 118 command supports the following operands:
 119 .Bl -tag -width Ds
 120 .It Xo
 121 .Ar resource
 122 .No // Ns Oo Ar workgroup Ns \&; Ns Oc Ns
 123 .Oo Ar user Ns Oo : Ns Ar password Ns Oc Ns @ Ns Oc Ns
 124 .Ar server Ns / Ns Ar share
 125 .Xc
 126 The name of the resource to be mounted.
 127 In addition to its name, you can specify the following information about the
 128 resource:
 129 .Bl -bullet
 130 .It
 131 .Ar password
 132 is the password associated with
 133 .Ar user .
 134 If
 135 .Ar password
 136 is not specified, the mount first attempts to use the password stored by the
 137 .Nm smbutil Cm login
 138 command (if any).
 139 If that password fails to authenticate, the
 140 .Nm mount_smbfs
 141 prompts you for a password.
 142 .It
 143 .Ar server
 144 is the DNS or NetBIOS name of the remote computer.
 145 .It
 146 .Ar share
 147 is the resource name on the remote server.
 148 .It
 149 .Ar user
 150 is the remote user name.
 151 If
 152 .Ar user
 153 is omitted, the logged in user ID is used.
 154 .It
 155 .Ar workgroup
 156 is the name of the workgroup or the Windows domain in which the user name is
 157 defined.
 158 .Pp
 159 If the resource includes a workgroup, you must escape the semicolon that
 160 appears after the workgroup name to prevent it from being interpreted by the
 161 command shell.
 162 For instance, surround the entire resource name with double quotes:
 163 .Bd -literal
 164 mount -F smbfs "//SALES;george@RSERVER" /mnt
 165 .Ed
 166 .El
 167 .It Ar mount-point
 168 The path to the location where the file system is to be mounted or unmounted.
 169 The
 170 .Nm mount
 171 command maintains a table of mounted file systems in the
 172 .Pa /etc/mnttab
 173 file.
 174 See the
 175 .Xr mnttab 4
 176 man page.
 177 .El
 178 .Sh OPTIONS
 179 See the
 180 .Xr mount 1M
 181 man page for the list of supported
 182 .Ar generic-options .
 183 .Bl -tag -width Ds
 184 .It Fl o Ar name Ns Oo = Ns Ar value Oc
 185 Sets the file system-specific properties.
 186 You can specify more than one name-value pair as a list of comma-separated
 187 pairs.
 188 No spaces are permitted in the list.
 189 The properties are as follows:
 190 .Bl -tag -width Ds
 191 .It Cm acl Ns | Ns Cm noacl
 192 Enable (or disable) presentation of Access Control Lists (ACLs)
 193 on files and directories under this
 194 .Xr smbfs 7FS
 195 mount.
 196 The default behavior is
 197 .Cm noacl ,
 198 which presents files and directories as owned by the owner of the mount point
 199 and having permissions based on
 200 .Cm fileperms
 201 or
 202 .Cm dirperms .
 203 With the
 204 .Cm acl
 205 mount option, files are presented with ACLs obtained from the SMB server.
 206 Setting the
 207 .Cm acl
 208 mount option is not advised unless the system is joined to an Active Directory
 209 domain and using
 210 .Xr ldap 1
 211 so it can correctly present ACL identities from the SMB server.
 212 .It Cm dirperms Ns = Ns Ar octaltriplet
 213 Specifies the permissions to be assigned to directories.
 214 The value must be specified as an octal triplet, such as
 215 .Ql 755 .
 216 The default value for the directory mode is taken from the
 217 .Cm fileperms
 218 setting, with execute permission added where
 219 .Cm fileperms
 220 has read permission.
 221 .Pp
 222 Note that these permissions have no relation to the rights granted by the SMB
 223 server.
 224 .It Cm fileperms Ns = Ns Ar octaltriplet
 225 Specifies the permissions to be assigned to files.
 226 The value must be specified as an octal triplet, such as
 227 .Ql 644 .
 228 The default value is
 229 .Ql 700 .
 230 .Pp
 231 Note that these permissions have no relation to the rights granted by the SMB
 232 server.
 233 .It Cm gid Ns = Ns Ar groupid
 234 Assigns the specified group ID to files.
 235 The default value is the group ID of the directory where the volume is mounted.
 236 .It Cm intr Ns | Ns Cm nointr
 237 Enable (or disable) cancellation of
 238 .Xr smbfs 7FS
 239 I/O operations when the user interrupts the calling thread (for example, by
 240 hitting Ctrl-C while an operation is underway).
 241 The default is
 242 .Cm intr
 243 (interruption enabled), so cancellation is normally allowed.
 244 .It Cm noprompt
 245 Suppresses the prompting for a password when mounting a share.
 246 This property enables you to permit anonymous access to a share.
 247 Anonymous access does not require a password.
 248 .Pp
 249 The
 250 .Nm mount
 251 operation fails if a password is required, the
 252 .Cm noprompt
 253 property is set, and no password is stored by the
 254 .Nm smbutil Cm login
 255 command.
 256 .It Cm retry_count Ns = Ns Ar number
 257 Specifies the number of SMBFS retries to attempt before the connection is
 258 marked as broken.
 259 By default, 4 attempts are made.
 260 .Pp
 261 The
 262 .Cm retry_count
 263 property value set by the
 264 .Nm mount
 265 command overrides the global value set in SMF or the value set in your
 266 .Pa \&.nsmbrc
 267 file.
 268 .It Cm timeout Ns = Ns Ar seconds
 269 Specifies the SMB request timeout.
 270 By default, the timeout is 15 seconds.
 271 .Pp
 272 The
 273 .Cm timeout
 274 property value set by the
 275 .Nm mount
 276 command overrides the global value set in SMF or the value set in your
 277 .Pa \&.nsmbrc
 278 file.
 279 .It Cm uid Ns = Ns Ar userid
 280 Assigns the specified user ID files.
 281 The default value is the owner ID of the directory where the volume is mounted.
 282 .It Cm xattr Ns | Ns Cm noxattr
 283 Enable (or disable) Extended Attributes in this mount point.
 284 This option defaults to
 285 .Cm xattr
 286 (enabled Extended Attributes), but note: if the SMB server does not support SMB
 287 "named streams",
 288 .Xr smbfs 7FS
 289 forces this option to
 290 .Cm noxattr .
 291 When a mount has the
 292 .Cm noxattr
 293 option, attempts to use Extended attributes fail with
 294 .Er EINVAL .
 295 .El
 296 .It Fl O
 297 Overlays mount.
 298 Allow the file system to be mounted over an existing mount point, making the
 299 underlying file system inaccessible.
 300 If a mount is attempted on a pre-existing mount point without setting this flag,
 301 the mount fails, producing the error "device busy."
 302 .El
 303 .Sh FILES
 304 .Bl -tag -width Pa
 305 .It Pa /etc/mnttab
 306 Table of mounted file systems.
 307 .It Pa /etc/dfs/fstypes
 308 Default distributed file system type.
 309 .It Pa /etc/vfstab
 310 Table of automatically mounted resources.
 311 .It Pa $HOME/.nsmbrc
 312 User-settable mount point configuration file to store the description for each
 313 connection.
 314 .El
 315 .Sh EXAMPLES
 316 .Bl -tag -width Ds
 317 .It Sy Example 1 No Mounting an SMBFS Share
 318 The following example shows how to mount the
 319 .Pa /tmp
 320 share from the
 321 .Em nano
 322 server in the
 323 .Em SALES
 324 workgroup on the local
 325 .Pa /mnt
 326 mount point.
 327 You must supply the password for the root user to successfully perform the mount
 328 operation.
 329 .Bd -literal
 330 # mount -F smbfs "//SALES;root@nano.sfbay/tmp" /mnt
 331 Password:
 332 .Ed
 333 .It Sy Example 2 No Verifying That an SMBFS File System Is Mounted
 334 The following example shows how to mount the
 335 .Pa /tmp
 336 share from the
 337 .Em nano
 338 server on the local
 339 .Pa /mnt
 340 mount point.
 341 You must supply the password for the root user to successfully perform the mount
 342 operation.
 343 .Bd -literal
 344 # mount -F smbfs //root@nano.sfbay/tmp /mnt
 345 Password:
 346 .Ed
 347 .Pp
 348 You can verify that the share is mounted in the following ways:
 349 .Bl -bullet
 350 .It
 351 View the file system entry in the
 352 .Pa /etc/mnttab
 353 file.
 354 .Bd -literal
 355 # grep root /etc/mnttab
 356 //root@nano.sfbay/tmp   /mnt    smbfs   dev=4900000     1177097833
 357 .Ed
 358 .It
 359 View the output of the
 360 .Ql mount
 361 command.
 362 .Bd -literal
 363 # mount | grep root
 364 /mnt on //root@nano.sfbay/tmp read/write/setuid/devices/dev=4900000 on
 365 Fri Apr 20 13:37:13 2007
 366 .Ed
 367 .It
 368 View the output of the
 369 .Ql df /mnt
 370 command.
 371 .Bd -literal
 372 # df /mnt
 373 /mnt               (//root@nano.sfbay/tmp): 3635872 blocks       -1 files
 374 .Ed
 375 .El
 376 .Pp
 377 Obtain information about the mounted share by viewing the output of the
 378 .Ql df -k /mnt
 379 command.
 380 .Bd -literal
 381 # df -k /mnt
 382 Filesystem            kbytes    used   avail capacity  Mounted on
 383 //root@nano.sfbay/tmp
 384                       1882384   64448 1817936     4%    /mnt
 385 .Ed
 386 .It Sy Example 3 No Unmounting an SMB Share
 387 This example assumes that an SMB share has been mounted on the
 388 .Pa /mnt
 389 mount point.
 390 The following command line unmounts the share from the mount point.
 391 .Bd -literal
 392 # umount /mnt
 393 .Ed
 394 .El
 395 .Sh INTERFACE STABILITY
 396 .Sy Committed
 397 .Sh SEE ALSO
 398 .Xr ldap 1 ,
 399 .Xr smbutil 1 ,
 400 .Xr mount 1M ,
 401 .Xr mountall 1M ,
 402 .Xr svcadm 1M ,
 403 .Xr acl 2 ,
 404 .Xr fcntl 2 ,
 405 .Xr link 2 ,
 406 .Xr mknod 2 ,
 407 .Xr mount 2 ,
 408 .Xr symlink 2 ,
 409 .Xr umount 2 ,
 410 .Xr mnttab 4 ,
 411 .Xr nsmbrc 4 ,
 412 .Xr vfstab 4 ,
 413 .Xr attributes 5 ,
 414 .Xr pcfs 7FS ,
 415 .Xr smbfs 7FS
 416 .Sh AUTHORS
 417 This manual page contains material originally authored by
 418 .An Boris Popov
 419 .Aq Mt bp@butya.kz ,
 420 .Aq Mt bp@FreeBSD.org .
 421 .Sh NOTES
 422 The SMB client always attempts to use
 423 .Xr gethostbyname 3NSL
 424 to resolve host names.
 425 If the host name cannot be resolved, the SMB client uses NetBIOS name
 426 resolution (NBNS).
 427 By default, the SMB client permits the use of NBNS to enable SMB clients in
 428 Windows environments to work without additional configuration.
 429 .Pp
 430 Since NBNS has been exploited in the past, you might want to disable it.
 431 To disable NBNS, set the
 432 .Em nbns-enabled
 433 service management facility property to
 434 .Cm false .
 435 By default,
 436 .Em nbns-enabled
 437 is set to
 438 .Cm true .
 439 .Pp
 440 If the directory on which a file system is to be mounted is a symbolic link,
 441 the file system is mounted on the directory to which the symbolic link refers,
 442 rather than being mounted on top of the symbolic link itself.