usage.rst 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862
  1. =====
  2. Usage
  3. =====
  4. This module supports the SMB3 family of advanced network protocols (as well
  5. as older dialects, originally called "CIFS" or SMB1).
  6. The CIFS VFS module for Linux supports many advanced network filesystem
  7. features such as hierarchical DFS like namespace, hardlinks, locking and more.
  8. It was designed to comply with the SNIA CIFS Technical Reference (which
  9. supersedes the 1992 X/Open SMB Standard) as well as to perform best practice
  10. practical interoperability with Windows 2000, Windows XP, Samba and equivalent
  11. servers. This code was developed in participation with the Protocol Freedom
  12. Information Foundation. CIFS and now SMB3 has now become a defacto
  13. standard for interoperating between Macs and Windows and major NAS appliances.
  14. Please see
  15. MS-SMB2 (for detailed SMB2/SMB3/SMB3.1.1 protocol specification)
  16. or https://samba.org/samba/PFIF/
  17. for more details.
  18. For questions or bug reports please contact:
  19. smfrench@gmail.com
  20. See the project page at: https://wiki.samba.org/index.php/LinuxCIFS_utils
  21. Build instructions
  22. ==================
  23. For Linux:
  24. 1) Download the kernel (e.g. from https://www.kernel.org)
  25. and change directory into the top of the kernel directory tree
  26. (e.g. /usr/src/linux-2.5.73)
  27. 2) make menuconfig (or make xconfig)
  28. 3) select cifs from within the network filesystem choices
  29. 4) save and exit
  30. 5) make
  31. Installation instructions
  32. =========================
  33. If you have built the CIFS vfs as module (successfully) simply
  34. type ``make modules_install`` (or if you prefer, manually copy the file to
  35. the modules directory e.g. /lib/modules/6.3.0-060300-generic/kernel/fs/smb/client/cifs.ko).
  36. If you have built the CIFS vfs into the kernel itself, follow the instructions
  37. for your distribution on how to install a new kernel (usually you
  38. would simply type ``make install``).
  39. If you do not have the utility mount.cifs (in the Samba 4.x source tree and on
  40. the CIFS VFS web site) copy it to the same directory in which mount helpers
  41. reside (usually /sbin). Although the helper software is not
  42. required, mount.cifs is recommended. Most distros include a ``cifs-utils``
  43. package that includes this utility so it is recommended to install this.
  44. Note that running the Winbind pam/nss module (logon service) on all of your
  45. Linux clients is useful in mapping Uids and Gids consistently across the
  46. domain to the proper network user. The mount.cifs mount helper can be
  47. found at cifs-utils.git on git.samba.org
  48. If cifs is built as a module, then the size and number of network buffers
  49. and maximum number of simultaneous requests to one server can be configured.
  50. Changing these from their defaults is not recommended. By executing modinfo::
  51. modinfo <path to cifs.ko>
  52. on kernel/fs/smb/client/cifs.ko the list of configuration changes that can be made
  53. at module initialization time (by running insmod cifs.ko) can be seen.
  54. Recommendations
  55. ===============
  56. To improve security the SMB2.1 dialect or later (usually will get SMB3.1.1) is now
  57. the new default. To use old dialects (e.g. to mount Windows XP) use "vers=1.0"
  58. on mount (or vers=2.0 for Windows Vista). Note that the CIFS (vers=1.0) is
  59. much older and less secure than the default dialect SMB3 which includes
  60. many advanced security features such as downgrade attack detection
  61. and encrypted shares and stronger signing and authentication algorithms.
  62. There are additional mount options that may be helpful for SMB3 to get
  63. improved POSIX behavior (NB: can use vers=3 to force SMB3 or later, never 2.1):
  64. ``mfsymlinks`` and either ``cifsacl`` or ``modefromsid`` (usually with ``idsfromsid``)
  65. Allowing User Mounts
  66. ====================
  67. To permit users to mount and unmount over directories they own is possible
  68. with the cifs vfs. A way to enable such mounting is to mark the mount.cifs
  69. utility as suid (e.g. ``chmod +s /sbin/mount.cifs``). To enable users to
  70. umount shares they mount requires
  71. 1) mount.cifs version 1.4 or later
  72. 2) an entry for the share in /etc/fstab indicating that a user may
  73. unmount it e.g.::
  74. //server/usersharename /mnt/username cifs user 0 0
  75. Note that when the mount.cifs utility is run suid (allowing user mounts),
  76. in order to reduce risks, the ``nosuid`` mount flag is passed in on mount to
  77. disallow execution of an suid program mounted on the remote target.
  78. When mount is executed as root, nosuid is not passed in by default,
  79. and execution of suid programs on the remote target would be enabled
  80. by default. This can be changed, as with nfs and other filesystems,
  81. by simply specifying ``nosuid`` among the mount options. For user mounts
  82. though to be able to pass the suid flag to mount requires rebuilding
  83. mount.cifs with the following flag: CIFS_ALLOW_USR_SUID
  84. There is a corresponding manual page for cifs mounting in the Samba 3.0 and
  85. later source tree in docs/manpages/mount.cifs.8
  86. Allowing User Unmounts
  87. ======================
  88. To permit users to unmount directories that they have user mounted (see above),
  89. the utility umount.cifs may be used. It may be invoked directly, or if
  90. umount.cifs is placed in /sbin, umount can invoke the cifs umount helper
  91. (at least for most versions of the umount utility) for umount of cifs
  92. mounts, unless umount is invoked with -i (which will avoid invoking a umount
  93. helper). As with mount.cifs, to enable user unmounts umount.cifs must be marked
  94. as suid (e.g. ``chmod +s /sbin/umount.cifs``) or equivalent (some distributions
  95. allow adding entries to a file to the /etc/permissions file to achieve the
  96. equivalent suid effect). For this utility to succeed the target path
  97. must be a cifs mount, and the uid of the current user must match the uid
  98. of the user who mounted the resource.
  99. Also note that the customary way of allowing user mounts and unmounts is
  100. (instead of using mount.cifs and unmount.cifs as suid) to add a line
  101. to the file /etc/fstab for each //server/share you wish to mount, but
  102. this can become unwieldy when potential mount targets include many
  103. or unpredictable UNC names.
  104. Samba Considerations
  105. ====================
  106. Most current servers support SMB2.1 and SMB3 which are more secure,
  107. but there are useful protocol extensions for the older less secure CIFS
  108. dialect, so to get the maximum benefit if mounting using the older dialect
  109. (CIFS/SMB1), we recommend using a server that supports the SNIA CIFS
  110. Unix Extensions standard (e.g. almost any version of Samba ie version
  111. 2.2.5 or later) but the CIFS vfs works fine with a wide variety of CIFS servers.
  112. Note that uid, gid and file permissions will display default values if you do
  113. not have a server that supports the Unix extensions for CIFS (such as Samba
  114. 2.2.5 or later). To enable the Unix CIFS Extensions in the Samba server, add
  115. the line::
  116. unix extensions = yes
  117. to your smb.conf file on the server. Note that the following smb.conf settings
  118. are also useful (on the Samba server) when the majority of clients are Unix or
  119. Linux::
  120. case sensitive = yes
  121. delete readonly = yes
  122. ea support = yes
  123. Note that server ea support is required for supporting xattrs from the Linux
  124. cifs client, and that EA support is present in later versions of Samba (e.g.
  125. 3.0.6 and later (also EA support works in all versions of Windows, at least to
  126. shares on NTFS filesystems). Extended Attribute (xattr) support is an optional
  127. feature of most Linux filesystems which may require enabling via
  128. make menuconfig. Client support for extended attributes (user xattr) can be
  129. disabled on a per-mount basis by specifying ``nouser_xattr`` on mount.
  130. The CIFS client can get and set POSIX ACLs (getfacl, setfacl) to Samba servers
  131. version 3.10 and later. Setting POSIX ACLs requires enabling both XATTR and
  132. then POSIX support in the CIFS configuration options when building the cifs
  133. module. POSIX ACL support can be disabled on a per mount basic by specifying
  134. ``noacl`` on mount.
  135. Some administrators may want to change Samba's smb.conf ``map archive`` and
  136. ``create mask`` parameters from the default. Unless the create mask is changed
  137. newly created files can end up with an unnecessarily restrictive default mode,
  138. which may not be what you want, although if the CIFS Unix extensions are
  139. enabled on the server and client, subsequent setattr calls (e.g. chmod) can
  140. fix the mode. Note that creating special devices (mknod) remotely
  141. may require specifying a mkdev function to Samba if you are not using
  142. Samba 3.0.6 or later. For more information on these see the manual pages
  143. (``man smb.conf``) on the Samba server system. Note that the cifs vfs,
  144. unlike the smbfs vfs, does not read the smb.conf on the client system
  145. (the few optional settings are passed in on mount via -o parameters instead).
  146. Note that Samba 2.2.7 or later includes a fix that allows the CIFS VFS to delete
  147. open files (required for strict POSIX compliance). Windows Servers already
  148. supported this feature. Samba server does not allow symlinks that refer to files
  149. outside of the share, so in Samba versions prior to 3.0.6, most symlinks to
  150. files with absolute paths (ie beginning with slash) such as::
  151. ln -s /mnt/foo bar
  152. would be forbidden. Samba 3.0.6 server or later includes the ability to create
  153. such symlinks safely by converting unsafe symlinks (ie symlinks to server
  154. files that are outside of the share) to a samba specific format on the server
  155. that is ignored by local server applications and non-cifs clients and that will
  156. not be traversed by the Samba server). This is opaque to the Linux client
  157. application using the cifs vfs. Absolute symlinks will work to Samba 3.0.5 or
  158. later, but only for remote clients using the CIFS Unix extensions, and will
  159. be invisible to Windows clients and typically will not affect local
  160. applications running on the same server as Samba.
  161. Use instructions
  162. ================
  163. Once the CIFS VFS support is built into the kernel or installed as a module
  164. (cifs.ko), you can use mount syntax like the following to access Samba or
  165. Mac or Windows servers::
  166. mount -t cifs //9.53.216.11/e$ /mnt -o username=myname,password=mypassword
  167. Before -o the option -v may be specified to make the mount.cifs
  168. mount helper display the mount steps more verbosely.
  169. After -o the following commonly used cifs vfs specific options
  170. are supported::
  171. username=<username>
  172. password=<password>
  173. domain=<domain name>
  174. Other cifs mount options are described below. Use of TCP names (in addition to
  175. ip addresses) is available if the mount helper (mount.cifs) is installed. If
  176. you do not trust the server to which are mounted, or if you do not have
  177. cifs signing enabled (and the physical network is insecure), consider use
  178. of the standard mount options ``noexec`` and ``nosuid`` to reduce the risk of
  179. running an altered binary on your local system (downloaded from a hostile server
  180. or altered by a hostile router).
  181. Although mounting using format corresponding to the CIFS URL specification is
  182. not possible in mount.cifs yet, it is possible to use an alternate format
  183. for the server and sharename (which is somewhat similar to NFS style mount
  184. syntax) instead of the more widely used UNC format (i.e. \\server\share)::
  185. mount -t cifs tcp_name_of_server:share_name /mnt -o user=myname,pass=mypasswd
  186. When using the mount helper mount.cifs, passwords may be specified via alternate
  187. mechanisms, instead of specifying it after -o using the normal ``pass=`` syntax
  188. on the command line:
  189. 1) By including it in a credential file. Specify credentials=filename as one
  190. of the mount options. Credential files contain two lines::
  191. username=someuser
  192. password=your_password
  193. 2) By specifying the password in the PASSWD environment variable (similarly
  194. the user name can be taken from the USER environment variable).
  195. 3) By specifying the password in a file by name via PASSWD_FILE
  196. 4) By specifying the password in a file by file descriptor via PASSWD_FD
  197. If no password is provided, mount.cifs will prompt for password entry
  198. Restrictions
  199. ============
  200. Servers must support either "pure-TCP" (port 445 TCP/IP CIFS connections) or RFC
  201. 1001/1002 support for "Netbios-Over-TCP/IP." This is not likely to be a
  202. problem as most servers support this.
  203. Valid filenames differ between Windows and Linux. Windows typically restricts
  204. filenames which contain certain reserved characters (e.g.the character :
  205. which is used to delimit the beginning of a stream name by Windows), while
  206. Linux allows a slightly wider set of valid characters in filenames. Windows
  207. servers can remap such characters when an explicit mapping is specified in
  208. the Server's registry. Samba starting with version 3.10 will allow such
  209. filenames (ie those which contain valid Linux characters, which normally
  210. would be forbidden for Windows/CIFS semantics) as long as the server is
  211. configured for Unix Extensions (and the client has not disabled
  212. /proc/fs/cifs/LinuxExtensionsEnabled). In addition the mount option
  213. ``mapposix`` can be used on CIFS (vers=1.0) to force the mapping of
  214. illegal Windows/NTFS/SMB characters to a remap range (this mount parameter
  215. is the default for SMB3). This remap (``mapposix``) range is also
  216. compatible with Mac (and "Services for Mac" on some older Windows).
  217. CIFS VFS Mount Options
  218. ======================
  219. A partial list of the supported mount options follows:
  220. username
  221. The user name to use when trying to establish
  222. the CIFS session.
  223. password
  224. The user password. If the mount helper is
  225. installed, the user will be prompted for password
  226. if not supplied.
  227. ip
  228. The ip address of the target server
  229. unc
  230. The target server Universal Network Name (export) to
  231. mount.
  232. domain
  233. Set the SMB/CIFS workgroup name prepended to the
  234. username during CIFS session establishment
  235. forceuid
  236. Set the default uid for inodes to the uid
  237. passed in on mount. For mounts to servers
  238. which do support the CIFS Unix extensions, such as a
  239. properly configured Samba server, the server provides
  240. the uid, gid and mode so this parameter should not be
  241. specified unless the server and clients uid and gid
  242. numbering differ. If the server and client are in the
  243. same domain (e.g. running winbind or nss_ldap) and
  244. the server supports the Unix Extensions then the uid
  245. and gid can be retrieved from the server (and uid
  246. and gid would not have to be specified on the mount.
  247. For servers which do not support the CIFS Unix
  248. extensions, the default uid (and gid) returned on lookup
  249. of existing files will be the uid (gid) of the person
  250. who executed the mount (root, except when mount.cifs
  251. is configured setuid for user mounts) unless the ``uid=``
  252. (gid) mount option is specified. Also note that permission
  253. checks (authorization checks) on accesses to a file occur
  254. at the server, but there are cases in which an administrator
  255. may want to restrict at the client as well. For those
  256. servers which do not report a uid/gid owner
  257. (such as Windows), permissions can also be checked at the
  258. client, and a crude form of client side permission checking
  259. can be enabled by specifying file_mode and dir_mode on
  260. the client. (default)
  261. forcegid
  262. (similar to above but for the groupid instead of uid) (default)
  263. noforceuid
  264. Fill in file owner information (uid) by requesting it from
  265. the server if possible. With this option, the value given in
  266. the uid= option (on mount) will only be used if the server
  267. can not support returning uids on inodes.
  268. noforcegid
  269. (similar to above but for the group owner, gid, instead of uid)
  270. uid
  271. Set the default uid for inodes, and indicate to the
  272. cifs kernel driver which local user mounted. If the server
  273. supports the unix extensions the default uid is
  274. not used to fill in the owner fields of inodes (files)
  275. unless the ``forceuid`` parameter is specified.
  276. gid
  277. Set the default gid for inodes (similar to above).
  278. file_mode
  279. If CIFS Unix extensions are not supported by the server
  280. this overrides the default mode for file inodes.
  281. fsc
  282. Enable local disk caching using FS-Cache (off by default). This
  283. option could be useful to improve performance on a slow link,
  284. heavily loaded server and/or network where reading from the
  285. disk is faster than reading from the server (over the network).
  286. This could also impact scalability positively as the
  287. number of calls to the server are reduced. However, local
  288. caching is not suitable for all workloads for e.g. read-once
  289. type workloads. So, you need to consider carefully your
  290. workload/scenario before using this option. Currently, local
  291. disk caching is functional for CIFS files opened as read-only.
  292. dir_mode
  293. If CIFS Unix extensions are not supported by the server
  294. this overrides the default mode for directory inodes.
  295. port
  296. attempt to contact the server on this tcp port, before
  297. trying the usual ports (port 445, then 139).
  298. iocharset
  299. Codepage used to convert local path names to and from
  300. Unicode. Unicode is used by default for network path
  301. names if the server supports it. If iocharset is
  302. not specified then the nls_default specified
  303. during the local client kernel build will be used.
  304. If server does not support Unicode, this parameter is
  305. unused.
  306. rsize
  307. default read size (usually 16K). The client currently
  308. can not use rsize larger than CIFSMaxBufSize. CIFSMaxBufSize
  309. defaults to 16K and may be changed (from 8K to the maximum
  310. kmalloc size allowed by your kernel) at module install time
  311. for cifs.ko. Setting CIFSMaxBufSize to a very large value
  312. will cause cifs to use more memory and may reduce performance
  313. in some cases. To use rsize greater than 127K (the original
  314. cifs protocol maximum) also requires that the server support
  315. a new Unix Capability flag (for very large read) which some
  316. newer servers (e.g. Samba 3.0.26 or later) do. rsize can be
  317. set from a minimum of 2048 to a maximum of 130048 (127K or
  318. CIFSMaxBufSize, whichever is smaller)
  319. wsize
  320. default write size (default 57344)
  321. maximum wsize currently allowed by CIFS is 57344 (fourteen
  322. 4096 byte pages)
  323. actimeo=n
  324. attribute cache timeout in seconds (default 1 second).
  325. After this timeout, the cifs client requests fresh attribute
  326. information from the server. This option allows to tune the
  327. attribute cache timeout to suit the workload needs. Shorter
  328. timeouts mean better the cache coherency, but increased number
  329. of calls to the server. Longer timeouts mean reduced number
  330. of calls to the server at the expense of less stricter cache
  331. coherency checks (i.e. incorrect attribute cache for a short
  332. period of time).
  333. rw
  334. mount the network share read-write (note that the
  335. server may still consider the share read-only)
  336. ro
  337. mount network share read-only
  338. version
  339. used to distinguish different versions of the
  340. mount helper utility (not typically needed)
  341. sep
  342. if first mount option (after the -o), overrides
  343. the comma as the separator between the mount
  344. parameters. e.g.::
  345. -o user=myname,password=mypassword,domain=mydom
  346. could be passed instead with period as the separator by::
  347. -o sep=.user=myname.password=mypassword.domain=mydom
  348. this might be useful when comma is contained within username
  349. or password or domain. This option is less important
  350. when the cifs mount helper cifs.mount (version 1.1 or later)
  351. is used.
  352. nosuid
  353. Do not allow remote executables with the suid bit
  354. program to be executed. This is only meaningful for mounts
  355. to servers such as Samba which support the CIFS Unix Extensions.
  356. If you do not trust the servers in your network (your mount
  357. targets) it is recommended that you specify this option for
  358. greater security.
  359. exec
  360. Permit execution of binaries on the mount.
  361. noexec
  362. Do not permit execution of binaries on the mount.
  363. dev
  364. Recognize block devices on the remote mount.
  365. nodev
  366. Do not recognize devices on the remote mount.
  367. suid
  368. Allow remote files on this mountpoint with suid enabled to
  369. be executed (default for mounts when executed as root,
  370. nosuid is default for user mounts).
  371. credentials
  372. Although ignored by the cifs kernel component, it is used by
  373. the mount helper, mount.cifs. When mount.cifs is installed it
  374. opens and reads the credential file specified in order
  375. to obtain the userid and password arguments which are passed to
  376. the cifs vfs.
  377. guest
  378. Although ignored by the kernel component, the mount.cifs
  379. mount helper will not prompt the user for a password
  380. if guest is specified on the mount options. If no
  381. password is specified a null password will be used.
  382. perm
  383. Client does permission checks (vfs_permission check of uid
  384. and gid of the file against the mode and desired operation),
  385. Note that this is in addition to the normal ACL check on the
  386. target machine done by the server software.
  387. Client permission checking is enabled by default.
  388. noperm
  389. Client does not do permission checks. This can expose
  390. files on this mount to access by other users on the local
  391. client system. It is typically only needed when the server
  392. supports the CIFS Unix Extensions but the UIDs/GIDs on the
  393. client and server system do not match closely enough to allow
  394. access by the user doing the mount, but it may be useful with
  395. non CIFS Unix Extension mounts for cases in which the default
  396. mode is specified on the mount but is not to be enforced on the
  397. client (e.g. perhaps when MultiUserMount is enabled)
  398. Note that this does not affect the normal ACL check on the
  399. target machine done by the server software (of the server
  400. ACL against the user name provided at mount time).
  401. serverino
  402. Use server's inode numbers instead of generating automatically
  403. incrementing inode numbers on the client. Although this will
  404. make it easier to spot hardlinked files (as they will have
  405. the same inode numbers) and inode numbers may be persistent,
  406. note that the server does not guarantee that the inode numbers
  407. are unique if multiple server side mounts are exported under a
  408. single share (since inode numbers on the servers might not
  409. be unique if multiple filesystems are mounted under the same
  410. shared higher level directory). Note that some older
  411. (e.g. pre-Windows 2000) do not support returning UniqueIDs
  412. or the CIFS Unix Extensions equivalent and for those
  413. this mount option will have no effect. Exporting cifs mounts
  414. under nfsd requires this mount option on the cifs mount.
  415. This is now the default if server supports the
  416. required network operation.
  417. noserverino
  418. Client generates inode numbers (rather than using the actual one
  419. from the server). These inode numbers will vary after
  420. unmount or reboot which can confuse some applications,
  421. but not all server filesystems support unique inode
  422. numbers.
  423. setuids
  424. If the CIFS Unix extensions are negotiated with the server
  425. the client will attempt to set the effective uid and gid of
  426. the local process on newly created files, directories, and
  427. devices (create, mkdir, mknod). If the CIFS Unix Extensions
  428. are not negotiated, for newly created files and directories
  429. instead of using the default uid and gid specified on
  430. the mount, cache the new file's uid and gid locally which means
  431. that the uid for the file can change when the inode is
  432. reloaded (or the user remounts the share).
  433. nosetuids
  434. The client will not attempt to set the uid and gid on
  435. on newly created files, directories, and devices (create,
  436. mkdir, mknod) which will result in the server setting the
  437. uid and gid to the default (usually the server uid of the
  438. user who mounted the share). Letting the server (rather than
  439. the client) set the uid and gid is the default. If the CIFS
  440. Unix Extensions are not negotiated then the uid and gid for
  441. new files will appear to be the uid (gid) of the mounter or the
  442. uid (gid) parameter specified on the mount.
  443. netbiosname
  444. When mounting to servers via port 139, specifies the RFC1001
  445. source name to use to represent the client netbios machine
  446. name when doing the RFC1001 netbios session initialize.
  447. direct
  448. Do not do inode data caching on files opened on this mount.
  449. This precludes mmapping files on this mount. In some cases
  450. with fast networks and little or no caching benefits on the
  451. client (e.g. when the application is doing large sequential
  452. reads bigger than page size without rereading the same data)
  453. this can provide better performance than the default
  454. behavior which caches reads (readahead) and writes
  455. (writebehind) through the local Linux client pagecache
  456. if oplock (caching token) is granted and held. Note that
  457. direct allows write operations larger than page size
  458. to be sent to the server.
  459. strictcache
  460. Use for switching on strict cache mode. In this mode the
  461. client read from the cache all the time it has Oplock Level II,
  462. otherwise - read from the server. All written data are stored
  463. in the cache, but if the client doesn't have Exclusive Oplock,
  464. it writes the data to the server.
  465. rwpidforward
  466. Forward pid of a process who opened a file to any read or write
  467. operation on that file. This prevent applications like WINE
  468. from failing on read and write if we use mandatory brlock style.
  469. acl
  470. Allow setfacl and getfacl to manage posix ACLs if server
  471. supports them. (default)
  472. noacl
  473. Do not allow setfacl and getfacl calls on this mount
  474. user_xattr
  475. Allow getting and setting user xattrs (those attributes whose
  476. name begins with ``user.`` or ``os2.``) as OS/2 EAs (extended
  477. attributes) to the server. This allows support of the
  478. setfattr and getfattr utilities. (default)
  479. nouser_xattr
  480. Do not allow getfattr/setfattr to get/set/list xattrs
  481. mapchars
  482. Translate six of the seven reserved characters (not backslash)::
  483. *?<>|:
  484. to the remap range (above 0xF000), which also
  485. allows the CIFS client to recognize files created with
  486. such characters by Windows's POSIX emulation. This can
  487. also be useful when mounting to most versions of Samba
  488. (which also forbids creating and opening files
  489. whose names contain any of these seven characters).
  490. This has no effect if the server does not support
  491. Unicode on the wire.
  492. nomapchars
  493. Do not translate any of these seven characters (default).
  494. nocase
  495. Request case insensitive path name matching (case
  496. sensitive is the default if the server supports it).
  497. (mount option ``ignorecase`` is identical to ``nocase``)
  498. posixpaths
  499. If CIFS Unix extensions are supported, attempt to
  500. negotiate posix path name support which allows certain
  501. characters forbidden in typical CIFS filenames, without
  502. requiring remapping. (default)
  503. noposixpaths
  504. If CIFS Unix extensions are supported, do not request
  505. posix path name support (this may cause servers to
  506. reject creatingfile with certain reserved characters).
  507. nounix
  508. Disable the CIFS Unix Extensions for this mount (tree
  509. connection). This is rarely needed, but it may be useful
  510. in order to turn off multiple settings all at once (ie
  511. posix acls, posix locks, posix paths, symlink support
  512. and retrieving uids/gids/mode from the server) or to
  513. work around a bug in server which implement the Unix
  514. Extensions.
  515. nobrl
  516. Do not send byte range lock requests to the server.
  517. This is necessary for certain applications that break
  518. with cifs style mandatory byte range locks (and most
  519. cifs servers do not yet support requesting advisory
  520. byte range locks).
  521. forcemandatorylock
  522. Even if the server supports posix (advisory) byte range
  523. locking, send only mandatory lock requests. For some
  524. (presumably rare) applications, originally coded for
  525. DOS/Windows, which require Windows style mandatory byte range
  526. locking, they may be able to take advantage of this option,
  527. forcing the cifs client to only send mandatory locks
  528. even if the cifs server would support posix advisory locks.
  529. ``forcemand`` is accepted as a shorter form of this mount
  530. option.
  531. nostrictsync
  532. If this mount option is set, when an application does an
  533. fsync call then the cifs client does not send an SMB Flush
  534. to the server (to force the server to write all dirty data
  535. for this file immediately to disk), although cifs still sends
  536. all dirty (cached) file data to the server and waits for the
  537. server to respond to the write. Since SMB Flush can be
  538. very slow, and some servers may be reliable enough (to risk
  539. delaying slightly flushing the data to disk on the server),
  540. turning on this option may be useful to improve performance for
  541. applications that fsync too much, at a small risk of server
  542. crash. If this mount option is not set, by default cifs will
  543. send an SMB flush request (and wait for a response) on every
  544. fsync call.
  545. nodfs
  546. Disable DFS (global name space support) even if the
  547. server claims to support it. This can help work around
  548. a problem with parsing of DFS paths with Samba server
  549. versions 3.0.24 and 3.0.25.
  550. remount
  551. remount the share (often used to change from ro to rw mounts
  552. or vice versa)
  553. cifsacl
  554. Report mode bits (e.g. on stat) based on the Windows ACL for
  555. the file. (EXPERIMENTAL)
  556. servern
  557. Specify the server 's netbios name (RFC1001 name) to use
  558. when attempting to setup a session to the server.
  559. This is needed for mounting to some older servers (such
  560. as OS/2 or Windows 98 and Windows ME) since they do not
  561. support a default server name. A server name can be up
  562. to 15 characters long and is usually uppercased.
  563. sfu
  564. When the CIFS Unix Extensions are not negotiated, attempt to
  565. create device files and fifos in a format compatible with
  566. Services for Unix (SFU). In addition retrieve bits 10-12
  567. of the mode via the SETFILEBITS extended attribute (as
  568. SFU does). In the future the bottom 9 bits of the
  569. mode also will be emulated using queries of the security
  570. descriptor (ACL).
  571. mfsymlinks
  572. Enable support for Minshall+French symlinks
  573. (see http://wiki.samba.org/index.php/UNIX_Extensions#Minshall.2BFrench_symlinks)
  574. This option is ignored when specified together with the
  575. 'sfu' option. Minshall+French symlinks are used even if
  576. the server supports the CIFS Unix Extensions.
  577. sign
  578. Must use packet signing (helps avoid unwanted data modification
  579. by intermediate systems in the route). Note that signing
  580. does not work with lanman or plaintext authentication.
  581. seal
  582. Must seal (encrypt) all data on this mounted share before
  583. sending on the network. Requires support for Unix Extensions.
  584. Note that this differs from the sign mount option in that it
  585. causes encryption of data sent over this mounted share but other
  586. shares mounted to the same server are unaffected.
  587. locallease
  588. This option is rarely needed. Fcntl F_SETLEASE is
  589. used by some applications such as Samba and NFSv4 server to
  590. check to see whether a file is cacheable. CIFS has no way
  591. to explicitly request a lease, but can check whether a file
  592. is cacheable (oplocked). Unfortunately, even if a file
  593. is not oplocked, it could still be cacheable (ie cifs client
  594. could grant fcntl leases if no other local processes are using
  595. the file) for cases for example such as when the server does not
  596. support oplocks and the user is sure that the only updates to
  597. the file will be from this client. Specifying this mount option
  598. will allow the cifs client to check for leases (only) locally
  599. for files which are not oplocked instead of denying leases
  600. in that case. (EXPERIMENTAL)
  601. sec
  602. Security mode. Allowed values are:
  603. none
  604. attempt to connection as a null user (no name)
  605. krb5
  606. Use Kerberos version 5 authentication
  607. krb5i
  608. Use Kerberos authentication and packet signing
  609. ntlm
  610. Use NTLM password hashing (default)
  611. ntlmi
  612. Use NTLM password hashing with signing (if
  613. /proc/fs/cifs/PacketSigningEnabled on or if
  614. server requires signing also can be the default)
  615. ntlmv2
  616. Use NTLMv2 password hashing
  617. ntlmv2i
  618. Use NTLMv2 password hashing with packet signing
  619. lanman
  620. (if configured in kernel config) use older
  621. lanman hash
  622. hard
  623. Retry file operations if server is not responding
  624. soft
  625. Limit retries to unresponsive servers (usually only
  626. one retry) before returning an error. (default)
  627. The mount.cifs mount helper also accepts a few mount options before -o
  628. including:
  629. =============== ===============================================================
  630. -S take password from stdin (equivalent to setting the environment
  631. variable ``PASSWD_FD=0``
  632. -V print mount.cifs version
  633. -? display simple usage information
  634. =============== ===============================================================
  635. With most 2.6 kernel versions of modutils, the version of the cifs kernel
  636. module can be displayed via modinfo.
  637. Misc /proc/fs/cifs Flags and Debug Info
  638. =======================================
  639. Informational pseudo-files:
  640. ======================= =======================================================
  641. DebugData Displays information about active CIFS sessions and
  642. shares, features enabled as well as the cifs.ko
  643. version.
  644. Stats Lists summary resource usage information as well as per
  645. share statistics.
  646. open_files List all the open file handles on all active SMB sessions.
  647. mount_params List of all mount parameters available for the module
  648. ======================= =======================================================
  649. Configuration pseudo-files:
  650. ======================= =======================================================
  651. SecurityFlags Flags which control security negotiation and
  652. also packet signing. Authentication (may/must)
  653. flags (e.g. for NTLMv2) may be combined with
  654. the signing flags. Specifying two different password
  655. hashing mechanisms (as "must use") on the other hand
  656. does not make much sense. Default flags are::
  657. 0x00C5
  658. (NTLMv2 and packet signing allowed). Some SecurityFlags
  659. may require enabling a corresponding menuconfig option.
  660. may use packet signing 0x00001
  661. must use packet signing 0x01001
  662. may use NTLMv2 0x00004
  663. must use NTLMv2 0x04004
  664. may use Kerberos security (krb5) 0x00008
  665. must use Kerberos 0x08008
  666. may use NTLMSSP 0x00080
  667. must use NTLMSSP 0x80080
  668. seal (packet encryption) 0x00040
  669. must seal 0x40040
  670. cifsFYI If set to non-zero value, additional debug information
  671. will be logged to the system error log. This field
  672. contains three flags controlling different classes of
  673. debugging entries. The maximum value it can be set
  674. to is 7 which enables all debugging points (default 0).
  675. Some debugging statements are not compiled into the
  676. cifs kernel unless CONFIG_CIFS_DEBUG2 is enabled in the
  677. kernel configuration. cifsFYI may be set to one or
  678. more of the following flags (7 sets them all)::
  679. +-----------------------------------------------+------+
  680. | log cifs informational messages | 0x01 |
  681. +-----------------------------------------------+------+
  682. | log return codes from cifs entry points | 0x02 |
  683. +-----------------------------------------------+------+
  684. | log slow responses | 0x04 |
  685. | (ie which take longer than 1 second) | |
  686. | | |
  687. | CONFIG_CIFS_STATS2 must be enabled in .config | |
  688. +-----------------------------------------------+------+
  689. traceSMB If set to one, debug information is logged to the
  690. system error log with the start of smb requests
  691. and responses (default 0)
  692. LookupCacheEnable If set to one, inode information is kept cached
  693. for one second improving performance of lookups
  694. (default 1)
  695. LinuxExtensionsEnabled If set to one then the client will attempt to
  696. use the CIFS "UNIX" extensions which are optional
  697. protocol enhancements that allow CIFS servers
  698. to return accurate UID/GID information as well
  699. as support symbolic links. If you use servers
  700. such as Samba that support the CIFS Unix
  701. extensions but do not want to use symbolic link
  702. support and want to map the uid and gid fields
  703. to values supplied at mount (rather than the
  704. actual values, then set this to zero. (default 1)
  705. dfscache List the content of the DFS cache.
  706. If set to 0, the client will clear the cache.
  707. ======================= =======================================================
  708. These experimental features and tracing can be enabled by changing flags in
  709. /proc/fs/cifs (after the cifs module has been installed or built into the
  710. kernel, e.g. insmod cifs). To enable a feature set it to 1 e.g. to enable
  711. tracing to the kernel message log type::
  712. echo 7 > /proc/fs/cifs/cifsFYI
  713. cifsFYI functions as a bit mask. Setting it to 1 enables additional kernel
  714. logging of various informational messages. 2 enables logging of non-zero
  715. SMB return codes while 4 enables logging of requests that take longer
  716. than one second to complete (except for byte range lock requests).
  717. Setting it to 4 requires CONFIG_CIFS_STATS2 to be set in kernel configuration
  718. (.config). Setting it to seven enables all three. Finally, tracing
  719. the start of smb requests and responses can be enabled via::
  720. echo 1 > /proc/fs/cifs/traceSMB
  721. Per share (per client mount) statistics are available in /proc/fs/cifs/Stats.
  722. Additional information is available if CONFIG_CIFS_STATS2 is enabled in the
  723. kernel configuration (.config). The statistics returned include counters which
  724. represent the number of attempted and failed (ie non-zero return code from the
  725. server) SMB3 (or cifs) requests grouped by request type (read, write, close etc.).
  726. Also recorded is the total bytes read and bytes written to the server for
  727. that share. Note that due to client caching effects this can be less than the
  728. number of bytes read and written by the application running on the client.
  729. Statistics can be reset to zero by ``echo 0 > /proc/fs/cifs/Stats`` which may be
  730. useful if comparing performance of two different scenarios.
  731. Also note that ``cat /proc/fs/cifs/DebugData`` will display information about
  732. the active sessions and the shares that are mounted.
  733. Enabling Kerberos (extended security) works but requires version 1.2 or later
  734. of the helper program cifs.upcall to be present and to be configured in the
  735. /etc/request-key.conf file. The cifs.upcall helper program is from the Samba
  736. project(https://www.samba.org). NTLM and NTLMv2 and LANMAN support do not
  737. require this helper. Note that NTLMv2 security (which does not require the
  738. cifs.upcall helper program), instead of using Kerberos, is sufficient for
  739. some use cases.
  740. DFS support allows transparent redirection to shares in an MS-DFS name space.
  741. In addition, DFS support for target shares which are specified as UNC
  742. names which begin with host names (rather than IP addresses) requires
  743. a user space helper (such as cifs.upcall) to be present in order to
  744. translate host names to ip address, and the user space helper must also
  745. be configured in the file /etc/request-key.conf. Samba, Windows servers and
  746. many NAS appliances support DFS as a way of constructing a global name
  747. space to ease network configuration and improve reliability.
  748. To use cifs Kerberos and DFS support, the Linux keyutils package should be
  749. installed and something like the following lines should be added to the
  750. /etc/request-key.conf file::
  751. create cifs.spnego * * /usr/local/sbin/cifs.upcall %k
  752. create dns_resolver * * /usr/local/sbin/cifs.upcall %k
  753. CIFS kernel module parameters
  754. =============================
  755. These module parameters can be specified or modified either during the time of
  756. module loading or during the runtime by using the interface::
  757. /sys/module/cifs/parameters/<param>
  758. i.e.::
  759. echo "value" > /sys/module/cifs/parameters/<param>
  760. More detailed descriptions of the available module parameters and their values
  761. can be seen by doing:
  762. modinfo cifs (or modinfo smb3)
  763. ================= ==========================================================
  764. 1. enable_oplocks Enable or disable oplocks. Oplocks are enabled by default.
  765. [Y/y/1]. To disable use any of [N/n/0].
  766. ================= ==========================================================