5 --------------------------------------------------
6 mount using the Common Internet File System (CIFS)
7 --------------------------------------------------
14 mount.cifs {service} {mount-point} [-o options]
16 This tool is part of the cifs-utils suite.
18 ``mount.cifs`` mounts a CIFS or SMB3 filesystem from Linux. It is
19 usually invoked indirectly by the mount(8) command when using the "-t cifs"
20 option. This command only works in Linux, and the kernel must support
21 the cifs filesystem. The SMB3 protocol is the successor to the CIFS (SMB)
22 protocol and is supported by most Windows servers, Azure (cloud storage),
23 Macs and many other commercial servers and Network Attached Storage
24 appliances as well as by the popular Open Source server Samba.
26 The mount.cifs utility attaches the UNC name (exported network
27 resource) specified as service (using ``//server/share`` syntax, where
28 "server" is the server name or IP address and "share" is the name of
29 the share) to the local directory mount-point.
31 Options to mount.cifs are specified as a comma-separated list of
32 ``key=value`` pairs. It is possible to send options other than those
33 listed here, assuming that the cifs filesystem kernel module
34 (``cifs.ko``) supports them. Unrecognized cifs mount options passed to
35 the cifs vfs kernel code will be logged to the kernel log.
37 ``mount.cifs`` causes the cifs vfs to launch a thread named
38 cifsd. After mounting it keeps running until the mounted resource is
39 unmounted (usually via the ``umount`` utility).
41 ``mount.cifs -V`` command displays the version of cifs mount helper.
43 ``modinfo cifs`` command displays the version of cifs module.
51 specifies the username to connect as. If this is not
52 given, then the environment variable USER is used.
54 Earlier versions of mount.cifs also allowed one to specify the
55 username in a ``user%password`` or ``workgroup/user`` or
56 ``workgroup/user%password`` to allow the password and workgroup to
57 be specified as part of the username. Support for those alternate
58 username formats is now deprecated and should no longer be
59 used. Users should use the discrete ``password=`` and ``domain=`` to
60 specify those values. While some versions of the cifs kernel module
61 accept ``user=`` as an abbreviation for this option, its use can
62 confuse the standard mount program into thinking that this is a
63 non-superuser mount. It is therefore recommended to use the full
64 ``username=`` option name.
67 specifies the CIFS password. If this option is not given then the
68 environment variable PASSWD is used. If the password is not specified
69 directly or indirectly via an argument to mount, mount.cifs will
70 prompt for a password, unless the guest option is specified.
72 Note that a password which contains the delimiter character (i.e. a
73 comma ',') will fail to be parsed correctly on the command
74 line. However, the same password defined in the PASSWD environment
75 variable or via a credentials file (see below) or entered at the
76 password prompt will be read correctly.
78 credentials=filename|cred=filename
79 specifies a file that contains a username and/or password and
80 optionally the name of the workgroup. The format of the file is::
86 This is preferred over having passwords in plaintext in a shared file,
87 such as */etc/fstab* . Be sure to protect any credentials file
91 sets the uid that will own all files or directories on the mounted
92 filesystem when the server does not provide ownership information. It
93 may be specified as either a username or a numeric uid. When not
94 specified, the default is uid 0. The mount.cifs helper must be at
95 version 1.10 or higher to support specifying the uid in non-numeric
96 form. See the section on `FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS`_
97 below for more information.
100 instructs the client to ignore any uid provided by the server for
101 files and directories and to always assign the owner to be the value
102 of the uid= option. See the section on
103 `FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS`_ below for more information.
106 sets the uid of the owner of the credentials cache. This is primarily
107 useful with ``sec=krb5``. The default is the real uid of the process
108 performing the mount. Setting this parameter directs the upcall to
109 look for a credentials cache owned by that user.
112 sets the gid that will own all files or directories on the mounted
113 filesystem when the server does not provide ownership information. It
114 may be specified as either a groupname or a numeric gid. When not
115 specified, the default is gid 0. The mount.cifs helper must be at
116 version 1.10 or higher to support specifying the gid in non-numeric
117 form. See the section on `FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS`_
118 below for more information.
121 instructs the client to ignore any gid provided by the server for
122 files and directories and to always assign the owner to be the value
123 of the gid= option. See the section on `FILE AND DIRECTORY OWNERSHIP
124 AND PERMISSIONS`_ below for more information.
127 Extract uid/gid from special SID instead of mapping it. See the
128 section on `FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS`_ below for
132 sets the port number on which the client will attempt to contact the
133 CIFS server. If this value is specified, look for an existing
134 connection with this port, and use that if one exists. If one doesn't
135 exist, try to create a new connection on that port. If that connection
136 fails, return an error. If this value isn't specified, look for an
137 existing connection on port 445 or 139. If no such connection exists,
138 try to connect on port 445 first and then port 139 if that
139 fails. Return an error if both fail.
142 When mounting to servers via port 139, specifies the RFC1001 source
143 name to use to represent the client netbios machine during the netbios
144 session initialization.
147 Similar to ``netbiosname`` except it specifies the netbios name of
148 the server instead of the client. Although rarely needed for mounting
149 to newer servers, this option is needed for mounting to some older
150 servers (such as OS/2 or Windows 98 and Windows ME) since when
151 connecting over port 139 they, unlike most newer servers, do not
152 support a default server name. A server name can be up to 15
153 characters long and is usually uppercased.
156 If the server does not support the CIFS Unix extensions this overrides
157 the default file mode.
160 If the server does not support the CIFS Unix extensions this overrides
161 the default mode for directories.
164 sets the destination IP address. This option is set automatically if
165 the server name portion of the requested UNC name can be resolved so
166 rarely needs to be specified by the user.
168 domain=arg|dom=arg|workgroup=arg
169 Sets the domain (workgroup) of the user. If no domains are given,
170 the empty domain will be used. Use ``domainauto`` to automatically
171 guess the domain of the server you are connecting to.
174 When using NTLM authentication and not providing a domain via
175 ``domain``, guess the domain from the server NTLM challenge.
176 This behavior used to be the default on kernels older than 2.6.36.
179 don't prompt for a password.
182 Charset used to convert local path names to and from Unicode. Unicode
183 is used by default for network path names if the server supports
184 it. If ``iocharset`` is not specified then the ``nls_default`` specified
185 during the local client kernel build will be used. If server does not
186 support Unicode, this parameter is unused.
195 If the CIFS Unix extensions are negotiated with the server the client
196 will attempt to set the effective uid and gid of the local process on
197 newly created files, directories, and devices (create, mkdir,
198 mknod). If the CIFS Unix Extensions are not negotiated, for newly
199 created files and directories instead of using the default uid and gid
200 specified on the the mount, cache the new file's uid and gid locally
201 which means that the uid for the file can change when the inode is
202 reloaded (or the user remounts the share).
205 The client will not attempt to set the uid and gid on on newly created
206 files, directories, and devices (create, mkdir, mknod) which will
207 result in the server setting the uid and gid to the default (usually
208 the server uid of the user who mounted the share). Letting the server
209 (rather than the client) set the uid and gid is the default. If the
210 CIFS Unix Extensions are not negotiated then the uid and gid for new
211 files will appear to be the uid (gid) of the mounter or the uid (gid)
212 parameter specified on the mount.
215 Client does permission checks (vfs_permission check of uid and gid of
216 the file against the mode and desired operation), Note that this is in
217 addition to the normal ACL check on the target machine done by the
218 server software. Client permission checking is enabled by default.
221 Client does not do permission checks. This can expose files on this
222 mount to access by other users on the local client system. It is
223 typically only needed when the server supports the CIFS Unix
224 Extensions but the UIDs/GIDs on the client and server system do not
225 match closely enough to allow access by the user doing the mount. Note
226 that this does not affect the normal ACL check on the target machine
227 done by the server software (of the server ACL against the user name
228 provided at mount time).
231 Instructs the server to maintain ownership and permissions in memory
232 that can't be stored on the server. This information can disappear
233 at any time (whenever the inode is flushed from the cache), so while
234 this may help make some applications work, it's behavior is somewhat
235 unreliable. See the section below on `FILE AND DIRECTORY OWNERSHIP
236 AND PERMISSIONS`_ for more information.
239 Cache mode. See the section below on `CACHE COHERENCY`_ for
240 details. Allowed values are:
242 - ``none`` - do not cache file data at all
243 - ``strict`` - follow the CIFS/SMB2 protocol strictly
244 - ``loose`` - allow loose caching semantics
246 The default in kernels prior to 3.7 was ``loose``. As of kernel 3.7 the
247 default is ``strict``.
250 Do not ask the server to flush on fsync().
251 Some servers perform non-buffered writes by default in which case
252 flushing is redundant. In workloads where a client is performing a
253 lot of small write + fsync combinations and where network latency is
254 much higher than the server latency, this brings a 2x performance
256 This option is also a good candidate in scenarios where we want
257 performance over consistency.
260 (default) In SMB2 and above, the client often has to open the root
261 of the share (empty path) in various places during mount, path
262 revalidation and the statfs(2) system call. This option cuts
263 redundant round trip traffic (opens and closes) by simply keeping
264 the directory handle for the root around once opened.
267 Disable caching of the share root directory handle.
270 The time (in milliseconds) for which the server should reserve the handle after
271 a failover waiting for the client to reconnect. When mounting with
272 resilienthandles or persistenthandles mount option, or when their use is
273 requested by the server (continuous availability shares) then this parameter
274 overrides the server default handle timeout (which for most servers is 120 seconds).
277 Forward pid of a process who opened a file to any read or write
278 operation on that file. This prevent applications like wine(1) from
279 failing on read and write if we use mandatory brlock style.
282 Translate six of the seven reserved characters (not backslash, but
283 including the colon, question mark, pipe, asterik, greater than and
284 less than characters) to the remap range (above 0xF000), which also
285 allows the CIFS client to recognize files created with such characters
286 by Windows's Services for Mac. This can also be useful when mounting to
287 most versions of Samba (which also forbids creating and opening files
288 whose names contain any of these seven characters). This has no effect
289 if the server does not support Unicode on the wire. Please note that
290 the files created with ``mapchars`` mount option may not be accessible
291 if the share is mounted without that option.
294 (default) Do not translate any of these seven characters.
297 Translate reserved characters similarly to ``mapchars`` but use the
298 mapping from Microsoft "Services For Unix".
301 currently unimplemented.
304 (default) currently unimplemented.
307 The program accessing a file on the cifs mounted file system will hang
308 when the server crashes.
311 (default) The program accessing a file on the cifs mounted file system
312 will not hang when the server crashes and will return errors to the
316 Do not allow POSIX ACL operations even if server would support them.
318 The CIFS client can get and set POSIX ACLs (getfacl, setfacl) to Samba
319 servers version 3.0.10 and later. Setting POSIX ACLs requires enabling
320 both ``CIFS_XATTR`` and then ``CIFS_POSIX`` support in the CIFS
321 configuration options when building the cifs module. POSIX ACL support
322 can be disabled on a per mount basis by specifying ``noacl`` on mount.
325 This option is used to map CIFS/NTFS ACLs to/from Linux permission
326 bits, map SIDs to/from UIDs and GIDs, and get and set Security
329 See section on `CIFS/NTFS ACL, SID/UID/GID MAPPING, SECURITY DESCRIPTORS`_
330 for more information.
333 File access by this user shall be done with the backup intent flag
334 set. Either a name or an id must be provided as an argument, there are
337 See section `ACCESSING FILES WITH BACKUP INTENT`_ for more details.
340 File access by users who are members of this group shall be done with
341 the backup intent flag set. Either a name or an id must be provided as
342 an argument, there are no default values.
344 See section `ACCESSING FILES WITH BACKUP INTENT`_ for more details.
347 Request case insensitive path name matching (case sensitive is the default if the
351 Synonym for ``nocase``.
354 Security mode. Allowed values are:
356 - ``none`` - attempt to connection as a null user (no name)
357 - ``krb5`` - Use Kerberos version 5 authentication
358 - ``krb5i`` - Use Kerberos authentication and forcibly enable packet signing
359 - ``ntlm`` - Use NTLM password hashing
360 - ``ntlmi`` - Use NTLM password hashing and force packet signing
361 - ``ntlmv2`` - Use NTLMv2 password hashing
362 - ``ntlmv2i`` - Use NTLMv2 password hashing and force packet signing
363 - ``ntlmssp`` - Use NTLMv2 password hashing encapsulated in Raw NTLMSSP message
364 - ``ntlmsspi`` - Use NTLMv2 password hashing encapsulated in Raw NTLMSSP message, and force packet signing
366 The default in mainline kernel versions prior to v3.8 was
367 ``sec=ntlm``. In v3.8, the default was changed to ``sec=ntlmssp``.
369 If the server requires signing during protocol negotiation, then it
370 may be enabled automatically. Packet signing may also be enabled
371 automatically if it's enabled in */proc/fs/cifs/SecurityFlags*.
374 Request encryption at the SMB layer. The encryption algorithm used
375 is AES-128-CCM. Requires SMB3 or above (see ``vers``).
378 Connect directly to the server using SMB Direct via a RDMA
379 adapter. Requires SMB3 or above (see ``vers``).
382 Enable resilient handles. If the server supports it, keep opened
383 files across reconnections. Requires SMB2.1 (see ``vers``).
386 (default) Disable resilient handles.
389 Enable persistent handles. If the server supports it, keep opened
390 files across reconnections. Persistent handles are also valid across
391 servers in a cluster and have stronger guarantees than resilient
392 handles. Requires SMB3 or above (see ``vers``).
395 (default) Disable persistent handles.
398 Mount a specific snapshot of the remote share. ``time`` must be a
399 positive integer identifying the snapshot requested (in 100-nanosecond
400 units that have elapsed since January 1, 1601, or alternatively it can
401 be specified in GMT format e.g. @GMT-2019.03.27-20.52.19). Supported
402 in the Linux kernel starting from v4.19.
405 Do not send byte range lock requests to the server. This is necessary
406 for certain applications that break with cifs style mandatory byte
407 range locks (and most cifs servers do not yet support requesting
408 advisory byte range locks).
411 Do not use POSIX locks even when available via unix
412 extensions. Always use cifs style mandatory locks.
415 Check cached leases locally instead of querying the server.
418 When the CIFS or SMB3 Unix Extensions are not negotiated, attempt to create
419 device files and fifos in a format compatible with Services for Unix
420 (SFU). In addition retrieve bits 10-12 of the mode via the
421 ``SETFILEBITS`` extended attribute (as SFU does). In the future the
422 bottom 9 bits of the mode mode also will be emulated using queries of
423 the security descriptor (ACL). [NB: requires version 1.39 or later of
424 the CIFS VFS. To recognize symlinks and be able to create symlinks in
425 an SFU interoperable form requires version 1.40 or later of the CIFS
429 Enable support for Minshall+French symlinks (see
430 `http://wiki.samba.org/index.php/UNIX_Extensions#Minshall.2BFrench_symlinks <http://wiki.samba.org/index.php/UNIX_Extensions#Minshall.2BFrench_symlinks>`_). This
431 option is ignored when specified together with the ``sfu``
432 option. Minshall+French symlinks are used even if the server supports
433 the CIFS Unix Extensions.
436 sets the interval at which echo requests are sent to the server on an
437 idling connection. This setting also affects the time required for a
438 connection to an unresponsive server to timeout. Here n is the echo
439 interval in seconds. The reconnection happens at twice the value of the
440 echo_interval set for an unresponsive server.
441 If this option is not given then the default value of 60 seconds is used.
442 The minimum tunable value is 1 second and maximum can go up to 600 seconds.
445 Use inode numbers (unique persistent file identifiers) returned by the
446 server instead of automatically generating temporary inode numbers on
447 the client. Although server inode numbers make it easier to spot
448 hardlinked files (as they will have the same inode numbers) and inode
449 numbers may be persistent (which is useful for some software), the
450 server does not guarantee that the inode numbers are unique if
451 multiple server side mounts are exported under a single share (since
452 inode numbers on the servers might not be unique if multiple
453 filesystems are mounted under the same shared higher level
454 directory). Note that not all servers support returning server inode
455 numbers, although those that support the CIFS Unix Extensions, and
456 Windows 2000 and later servers typically do support this (although not
457 necessarily on every local server filesystem). Parameter has no effect
458 if the server lacks support for returning inode numbers or
459 equivalent. This behavior is enabled by default.
462 Client generates inode numbers itself rather than using the actual
463 ones from the server.
465 See section `INODE NUMBERS`_ for more information.
468 (default) Enable Unix Extensions for this mount. Requires CIFS
469 (vers=1.0) or SMB3.1.1 (vers=3.1.1) and a server supporting them.
471 noposix|nounix|nolinux
472 Disable the Unix Extensions for this mount. This can be useful in
473 order to turn off multiple settings at once. This includes POSIX acls,
474 POSIX locks, POSIX paths, symlink support and retrieving
475 uids/gids/mode from the server. This can also be useful to work around
476 a bug in a server that supports Unix Extensions.
478 See section `INODE NUMBERS`_ for more information.
481 Do not allow getfattr/setfattr to get/set xattrs, even if server would
482 support it otherwise. The default is for xattr support to be enabled.
485 Do not follow Distributed FileSystem referrals. IO on a file not
486 stored on the server will fail instead of connecting to the target
487 server transparently.
490 Use fixed size for kernel recv/send socket buffers.
493 Do not try to reuse sockets if the system is already connected to
494 the server via an existing mount point. This will make the client
495 always make a new connection to the server no matter what he is
496 already connected to. This can be useful in simulating multiple
497 clients connecting to the same server, as each mount point
498 will use a different TCP socket.
501 Send data on the socket using non blocking operations (MSG_DONTWAIT flag).
504 Maximum amount of data that the kernel will request in a read request
505 in bytes. Maximum size that servers will accept is typically 8MB for SMB3
506 or later dialects. Default requested during mount is 4MB. Prior to the 4.20
507 kernel the default requested was 1MB. Prior to the SMB2.1 dialect the
508 maximum was usually 64K.
511 Maximum amount of data that the kernel will send in a write request in
512 bytes. Maximum size that servers will accept is typically 8MB for SMB3
513 or later dialects. Default requested during mount is 4MB. Prior to the 4.20
514 kernel the default requested was 1MB. Prior to the SMB2.1 dialect the
515 maximum was usually 64K.
518 Override the default blocksize (1MB) reported on SMB3 files (requires
519 kernel version of 5.1 or later). Prior to kernel version 5.1, the
520 blocksize was always reported as 16K instead of 1MB (and was not
521 configurable) which can hurt the performance of tools like cp and scp
522 (especially for uncached I/O) which decide on the read and write size
523 to use for file copies based on the inode blocksize. bsize may not be
524 less than 16K or greater than 16M.
527 Maximum credits the SMB2 client can have. Default is 32000. Must be
528 set to a number between 20 and 60000.
531 Enable local disk caching using FS-Cache for CIFS. This option could
532 be useful to improve performance on a slow link, heavily loaded server
533 and/or network where reading from the disk is faster than reading from
534 the server (over the network). This could also impact the scalability
535 positively as the number of calls to the server are reduced. But, be
536 warned that local caching is not suitable for all workloads, for e.g.,
537 read-once type workloads. So, you need to consider carefully the
538 situation/workload before using this option. Currently, local disk
539 caching is enabled for CIFS files opened as read-only.
541 **NOTE**: This feature is available only in the recent kernels that
542 have been built with the kernel config option
543 ``CONFIG_CIFS_FSCACHE``. You also need to have ``cachefilesd``
544 daemon installed and running to make the cache operational.
547 Map user accesses to individual credentials when accessing the
548 server. By default, CIFS mounts only use a single set of user
549 credentials (the mount credentials) when accessing a share. With this
550 option, the client instead creates a new session with the server using
551 the user's credentials whenever a new user accesses the mount.
552 Further accesses by that user will also use those credentials. Because
553 the kernel cannot prompt for passwords, multiuser mounts are limited
554 to mounts using ``sec=`` options that don't require passwords.
556 With this change, it's feasible for the server to handle permissions
557 enforcement, so this option also implies ``noperm`` . Furthermore, when
558 unix extensions aren't in use and the administrator has not overridden
559 ownership using the ``uid=`` or ``gid=`` options, ownership of files is
560 presented as the current user accessing the share.
563 The time (in seconds) that the CIFS client caches attributes of a file or
564 directory before it requests attribute information from a server. During this
565 period the changes that occur on the server remain undetected until the client
566 checks the server again.
568 By default, the attribute cache timeout is set to 1 second. This means
569 more frequent on-the-wire calls to the server to check whether
570 attributes have changed which could impact performance. With this
571 option users can make a tradeoff between performance and cache
572 metadata correctness, depending on workload needs. Shorter timeouts
573 mean better cache coherency, but frequent increased number of calls to
574 the server. Longer timeouts mean a reduced number of calls to the
575 server but looser cache coherency. The ``actimeo`` value is a positive
576 integer that can hold values between 0 and a maximum value of 2^30 \*
577 HZ (frequency of timer interrupt) setting.
580 If unix extensions are enabled on a share, then the client will
581 typically allow filenames to include any character besides '/' in a
582 pathname component, and will use forward slashes as a pathname
583 delimiter. This option prevents the client from attempting to
584 negotiate the use of posix-style pathnames to the server.
587 Inverse of ``noposixpaths`` .
590 SMB protocol version. Allowed values are:
592 - 1.0 - The classic CIFS/SMBv1 protocol.
593 - 2.0 - The SMBv2.002 protocol. This was initially introduced in
594 Windows Vista Service Pack 1, and Windows Server 2008. Note that
595 the initial release version of Windows Vista spoke a slightly
596 different dialect (2.000) that is not supported.
597 - 2.1 - The SMBv2.1 protocol that was introduced in Microsoft Windows 7 and Windows Server 2008R2.
598 - 3.0 - The SMBv3.0 protocol that was introduced in Microsoft Windows 8 and Windows Server 2012.
599 - 3.02 or 3.0.2 - The SMBv3.0.2 protocol that was introduced in Microsoft Windows 8.1 and Windows Server 2012R2.
600 - 3.1.1 or 3.11 - The SMBv3.1.1 protocol that was introduced in Microsoft Windows 10 and Windows Server 2016.
601 - 3 - The SMBv3.0 protocol version and above.
602 - default - Tries to negotiate the highest SMB2+ version supported by both the client and server.
604 If no dialect is specified on mount vers=default is used.
605 To check ``Dialect`` refer to /proc/fs/cifs/DebugData
607 Note too that while this option governs the protocol version used, not
608 all features of each version are available.
610 The default since v4.13.5 is for the client and server to negotiate
611 the highest possible version greater than or equal to ``2.1``. In
612 kernels prior to v4.13, the default was ``1.0``. For kernels
613 between v4.13 and v4.13.5 the default is ``3.0``.
616 Print additional debugging information for the mount. Note that this
617 parameter must be specified before the ``-o`` . For example::
619 mount -t cifs //server/share /mnt --verbose -o user=username
622 *********************************
623 SERVICE FORMATTING AND DELIMITERS
624 *********************************
626 It's generally preferred to use forward slashes (/) as a delimiter in
627 service names. They are considered to be the "universal delimiter"
628 since they are generally not allowed to be embedded within path
629 components on Windows machines and the client can convert them to
630 backslashes (\\) unconditionally. Conversely, backslash characters are
631 allowed by POSIX to be part of a path component, and can't be
632 automatically converted in the same way.
634 ``mount.cifs`` will attempt to convert backslashes to forward slashes
635 where it's able to do so, but it cannot do so in any path component
636 following the sharename.
644 When Unix Extensions are enabled, we use the actual inode number
645 provided by the server in response to the POSIX calls as an inode
648 When Unix Extensions are disabled and ``serverino`` mount option is
649 enabled there is no way to get the server inode number. The client
650 typically maps the server-assigned ``UniqueID`` onto an inode number.
652 Note that the ``UniqueID`` is a different value from the server inode
653 number. The ``UniqueID`` value is unique over the scope of the entire
654 server and is often greater than 2 power 32. This value often makes
655 programs that are not compiled with LFS (Large File Support), to
656 trigger a glibc ``EOVERFLOW`` error as this won't fit in the target
657 structure field. It is strongly recommended to compile your programs
658 with LFS support (i.e. with ``-D_FILE_OFFSET_BITS=64``) to prevent this
659 problem. You can also use ``noserverino`` mount option to generate
660 inode numbers smaller than 2 power 32 on the client. But you may not
661 be able to detect hardlinks properly.
667 With a network filesystem such as CIFS or NFS, the client must contend
668 with the fact that activity on other clients or the server could
669 change the contents or attributes of a file without the client being
670 aware of it. One way to deal with such a problem is to mandate that
671 all file accesses go to the server directly. This is performance
672 prohibitive however, so most protocols have some mechanism to allow
673 the client to cache data locally.
675 The CIFS protocol mandates (in effect) that the client should not
676 cache file data unless it holds an opportunistic lock (aka oplock) or
677 a lease. Both of these entities allow the client to guarantee certain
678 types of exclusive access to a file so that it can access its contents
679 without needing to continually interact with the server. The server
680 will call back the client when it needs to revoke either of them and
681 allow the client a certain amount of time to flush any cached data.
683 The cifs client uses the kernel's pagecache to cache file data. Any
684 I/O that's done through the pagecache is generally page-aligned. This
685 can be problematic when combined with byte-range locks as Windows'
686 locking is mandatory and can block reads and writes from occurring.
688 ``cache=none`` means that the client never utilizes the cache for
689 normal reads and writes. It always accesses the server directly to
690 satisfy a read or write request.
692 ``cache=strict`` means that the client will attempt to follow the
693 CIFS/SMB2 protocol strictly. That is, the cache is only trusted when
694 the client holds an oplock. When the client does not hold an oplock,
695 then the client bypasses the cache and accesses the server directly to
696 satisfy a read or write request. By doing this, the client avoids
697 problems with byte range locks. Additionally, byte range locks are
698 cached on the client when it holds an oplock and are "pushed" to the
699 server when that oplock is recalled.
701 ``cache=loose`` allows the client to use looser protocol semantics
702 which can sometimes provide better performance at the expense of cache
703 coherency. File access always involves the pagecache. When an oplock
704 or lease is not held, then the client will attempt to flush the cache
705 soon after a write to a file. Note that that flush does not
706 necessarily occur before a write system call returns.
708 In the case of a read without holding an oplock, the client will
709 attempt to periodically check the attributes of the file in order to
710 ascertain whether it has changed and the cache might no longer be
711 valid. This mechanism is much like the one that NFSv2/3 use for cache
712 coherency, but it particularly problematic with CIFS. Windows is
713 quite "lazy" with respect to updating the ``LastWriteTime`` field that
714 the client uses to verify this. The effect is that ``cache=loose`` can
715 cause data corruption when multiple readers and writers are working on
718 Because of this, when multiple clients are accessing the same set of
719 files, then ``cache=strict`` is recommended. That helps eliminate
720 problems with cache coherency by following the CIFS/SMB2 protocols
723 Note too that no matter what caching model is used, the client will
724 always use the pagecache to handle mmap'ed files. Writes to mmap'ed
725 files are only guaranteed to be flushed to the server when msync() is
726 called, or on close().
728 The default in kernels prior to 3.7 was ``loose``. As of 3.7, the
729 default is ``strict``.
731 ********************************************************
732 CIFS/NTFS ACL, SID/UID/GID MAPPING, SECURITY DESCRIPTORS
733 ********************************************************
735 This option is used to work with file objects which posses Security
736 Descriptors and CIFS/NTFS ACL instead of UID, GID, file permission
737 bits, and POSIX ACL as user authentication model. This is the most
738 common authentication model for CIFS servers and is the one used by
741 Support for this requires both CIFS_XATTR and CIFS_ACL support in the
742 CIFS configuration options when building the cifs module.
744 A CIFS/NTFS ACL is mapped to file permission bits using an algorithm
745 specified in the following Microsoft TechNet document:
747 `http://technet.microsoft.com/en-us/library/bb463216.aspx <http://technet.microsoft.com/en-us/library/bb463216.aspx>`_
749 In order to map SIDs to/from UIDs and GIDs, the following is required:
751 - a kernel upcall to the ``cifs.idmap`` utility set up via request-key.conf(5)
752 - winbind support configured via nsswitch.conf(5) and smb.conf(5)
754 Please refer to the respective manpages of cifs.idmap(8) and
755 winbindd(8) for more information.
757 Security descriptors for a file object can be retrieved and set
758 directly using extended attribute named ``system.cifs_acl``. The
759 security descriptors presented via this interface are "raw" blobs of
760 data and need a userspace utility to either parse and format or to
761 assemble it such as getcifsacl(1) and setcifsacl(1)
764 Some of the things to consider while using this mount option:
766 - There may be an increased latency when handling metadata due to
767 additional requests to get and set security descriptors.
768 - The mapping between a CIFS/NTFS ACL and POSIX file permission bits
769 is imperfect and some ACL information may be lost in the
771 - If either upcall to cifs.idmap is not setup correctly or winbind is
772 not configured and running, ID mapping will fail. In that case uid
773 and gid will default to either to those values of the share or to
774 the values of uid and/or gid mount options if specified.
776 **********************************
777 ACCESSING FILES WITH BACKUP INTENT
778 **********************************
780 For an user on the server, desired access to a file is determined by
781 the permissions and rights associated with that file. This is
782 typically accomplished using ownership and ACL. For a user who does
783 not have access rights to a file, it is still possible to access that
784 file for a specific or a targeted purpose by granting special rights.
785 One of the specific purposes is to access a file with the intent to
786 either backup or restore i.e. backup intent. The right to access a
787 file with the backup intent can typically be granted by making that
788 user a part of the built-in group *Backup Operators*. Thus, when
789 this user attempts to open a file with the backup intent, open request
790 is sent by setting the bit ``FILE_OPEN_FOR_BACKUP_INTENT`` as one of
791 the ``CreateOptions``.
793 As an example, on a Windows server, a user named *testuser*, cannot open
794 this file with such a security descriptor::
800 ACL:Administrator:ALLOWED/0x0/FULL
802 But the user *testuser*, if it becomes part of the *Backup Operators*
803 group, can open the file with the backup intent.
805 Any user on the client side who can authenticate as such a user on the
806 server, can access the files with the backup intent. But it is
807 desirable and preferable for security reasons amongst many, to
808 restrict this special right.
810 The mount option ``backupuid`` is used to restrict this special right
811 to a user which is specified by either a name or an id. The mount
812 option ``backupgid`` is used to restrict this special right to the
813 users in a group which is specified by either a name or an id. Only
814 users matching either backupuid or backupgid shall attempt to access
815 files with backup intent. These two mount options can be used
818 ********************************************
819 FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS
820 ********************************************
822 The core CIFS protocol does not provide unix ownership information or
823 mode for files and directories. Because of this, files and directories
824 will generally appear to be owned by whatever values the ``uid=`` or
825 ``gid=`` options are set, and will have permissions set to the default
826 ``file_mode`` and ``dir_mode`` for the mount. Attempting to change these
827 values via chmod/chown will return success but have no effect.
829 When the client and server negotiate unix extensions, files and
830 directories will be assigned the uid, gid, and mode provided by the
831 server. Because CIFS mounts are generally single-user, and the same
832 credentials are used no matter what user accesses the mount, newly
833 created files and directories will generally be given ownership
834 corresponding to whatever credentials were used to mount the share.
836 If the uid's and gid's being used do not match on the client and
837 server, the ``forceuid`` and ``forcegid`` options may be helpful. Note
838 however, that there is no corresponding option to override the
839 mode. Permissions assigned to a file when ``forceuid`` or ``forcegid``
840 are in effect may not reflect the the real permissions.
842 When unix extensions are not negotiated, it's also possible to emulate
843 them locally on the server using the ``dynperm`` mount option. When
844 this mount option is in effect, newly created files and directories
845 will receive what appear to be proper permissions. These permissions
846 are not stored on the server however and can disappear at any time in
847 the future (subject to the whims of the kernel flushing out the inode
848 cache). In general, this mount option is discouraged.
850 It's also possible to override permission checking on the client
851 altogether via the ``noperm`` option. Server-side permission checks
852 cannot be overridden. The permission checks done by the server will
853 always correspond to the credentials used to mount the share, and not
854 necessarily to the user who is accessing the share.
856 *********************
857 ENVIRONMENT VARIABLES
858 *********************
860 The variable ``USER`` may contain the username of the person to be used
861 to authenticate to the server. The variable can be used to set both
862 username and password by using the format ``username%password``.
864 The variable ``PASSWD`` may contain the password of the person using
867 The variable ``PASSWD_FILE`` may contain the pathname of a file to read
868 the password from. A single line of input is read and used as the
875 This command may be used only by root, unless installed setuid, in
876 which case the noexec and nosuid mount flags are enabled. When
877 installed as a setuid program, the program follows the conventions set
878 forth by the mount program for user mounts, with the added restriction
879 that users must be able to chdir() into the mountpoint prior to the
880 mount in order to be able to mount onto it.
882 Some samba client tools like smbclient(8) honour client-side
883 configuration parameters present in *smb.conf*. Unlike those client
884 tools, ``mount.cifs`` ignores *smb.conf* completely.
890 The primary mechanism for making configuration changes and for reading
891 debug information for the cifs vfs is via the Linux /proc
892 filesystem. In the directory */proc/fs/cifs* are various
893 configuration files and pseudo files which can display debug information
894 and performance statistics. There are additional startup options such as
895 maximum buffer size and number of buffers which only may be set when the
896 kernel cifs vfs (cifs.ko module) is loaded. These can be seen by
897 running the ``modinfo`` utility against the file cifs.ko which will
898 list the options that may be passed to cifs during module installation
899 (device driver load). For more information see the kernel file
900 *fs/cifs/README*. When configuring dynamic tracing (trace-cmd)
901 note that the list of SMB3 events which can be enabled can be seen at:
902 */sys/kernel/debug/tracing/events/cifs/*.
908 The use of SMB2.1 or later (including the latest dialect SMB3.1.1)
909 is recommended for improved security and SMB1 is no longer requested
910 by default at mount time. Old dialects such as CIFS (SMB1, ie vers=1.0)
911 have much weaker security. Use of CIFS (SMB1) can be disabled by
912 modprobe cifs disable_legacy_dialects=y.
918 Mounting using the CIFS URL specification is currently not supported.
920 The credentials file does not handle usernames or passwords with
923 Note that the typical response to a bug report is a suggestion to try
924 the latest version first. So please try doing that first, and always
925 include which versions you use of relevant software when reporting
926 bugs (minimum: mount.cifs (try ``mount.cifs -V``), kernel (see
927 */proc/version*) and server type you are trying to contact.
933 This man page is correct for version 2.18 of the cifs vfs filesystem
934 (roughly Linux kernel 5.0).
940 cifs.upcall(8), getcifsacl(1), setcifsacl(1)
942 *Documentation/filesystems/cifs.txt* and *fs/cifs/README* in the
943 Linux kernel source tree may contain additional options and
952 The maintainer of the Linux cifs vfs is Steve French. The maintainer of the
953 cifs-utils suite of user space tools is Pavel Shilovsky. The Linux CIFS Mailing
954 list is the preferred place to ask questions regarding these programs.