← Documents Documentation/admin-guide/cifs/usage.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / CIFS

CIFS and SMB3 usage

CIFS VFS의 build·설치, 안전한 dialect 선택, user mount, Samba 설정, mount option, /proc/fs/cifs 진단과 module parameter를 설명합니다.

Source pathDocumentation/admin-guide/cifs/usage.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

Build, 설치와 기본 mount

usage.rst:1-275

지원 SMB dialect와 server, kernel build·module 설치, 보안 권장사항, user mount/unmount, Samba Unix Extensions, credential 전달과 filename 제한을 정리합니다.

Session identity와 I/O 성능 option

usage.rst:276-392

Username·domain·UID/GID·mode의 결정 과정과 FS-Cache, transfer size, Unicode codepage, attribute cache timeout의 tradeoff를 설명합니다.

Permission, inode, cache와 metadata

usage.rst:393-559

Mountpoint 실행 policy, credential helper, client permission, server inode, create owner, page cache, ACL, xattr와 reserved character mapping option을 다룹니다.

Path, locking과 protocol security

usage.rst:560-707

POSIX path, Unix Extensions, byte-range locking, fsync, DFS, legacy compatibility, signing·encryption·authentication 및 retry option을 설명합니다.

Procfs 진단과 module parameter

usage.rst:708-864

`/proc/fs/cifs`의 session·statistics·security·trace interface, Kerberos와 DFS upcall, keyutils 및 sysfs module parameter를 정리합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

지원 protocol, interoperability와 project 정보

1-28

이 module은 고급 network protocol인 SMB3 계열과, 원래 CIFS 또는 SMB1이라고 불렸던 이전 dialect를 지원합니다.

Linux용 CIFS VFS module은 계층형 DFS 유사 namespace, hardlink, locking 등 여러 고급 network filesystem 기능을 지원합니다. 이 module은 1992년 X/Open SMB Standard를 대체한 SNIA CIFS Technical Reference를 준수하고, Windows 2000, Windows XP, Samba 및 이에 준하는 server와 실용적인 best-practice interoperability를 제공하도록 설계됐습니다.

이 code는 Protocol Freedom Information Foundation과 협력해 개발됐습니다. CIFS와 현재의 SMB3는 Mac, Windows 및 주요 NAS appliance 사이의 interoperability를 위한 사실상 표준이 됐습니다.

자세한 SMB2, SMB3, SMB3.1.1 protocol specification은 MS-SMB2를 참조하고, 관련 정보는 `https://samba.org/samba/PFIF/`에서 확인하십시오. 질문과 bug report는 `smfrench@gmail.com`으로 보내며, project page는 `https://wiki.samba.org/index.php/LinuxCIFS_utils`입니다.

CIFS VFS protocol과 server 범위
CIFS / SMB1SMB2SMB3SMB3.1.1
Linux CIFS VFSWindowsSambaMacNAS appliance

Legacy dialect 호환성과 modern SMB3 interoperability를 한 client가 제공합니다.

Linux kernel build 절차

29-42

Linux에서 CIFS VFS를 build하려면 다음 순서를 따릅니다. Command와 source tree 경로는 원문 표기를 유지합니다.

  • 1) `https://www.kernel.org` 등에서 kernel을 내려받고 `/usr/src/linux-2.5.73` 같은 kernel directory tree 최상위로 이동합니다.
  • 2) `make menuconfig` 또는 `make xconfig`를 실행합니다.
  • 3) Network filesystem 선택지에서 `cifs`를 선택합니다.
  • 4) 설정을 저장하고 종료합니다.
  • 5) `make`를 실행합니다.
1) Download the kernel (e.g. from https://www.kernel.org)
   and change directory into the top of the kernel directory tree
   (e.g. /usr/src/linux-2.5.73)
2) make menuconfig (or make xconfig)
3) select cifs from within the network filesystem choices
4) save and exit
5) make
CIFS VFS build 흐름
Download kernelEnter source rootmake menuconfigSelect cifsSavemake

Kernel source 준비부터 cifs 선택과 compile까지의 순서입니다.

Module, built-in kernel과 mount helper 설치

43-73

CIFS VFS를 module로 성공적으로 build했다면 `make modules_install`을 실행합니다. 수동 설치를 선호하면 생성된 file을 `/lib/modules/6.3.0-060300-generic/kernel/fs/smb/client/cifs.ko` 같은 modules directory로 복사할 수 있습니다.

CIFS VFS를 kernel 자체에 built-in했다면 distribution의 새 kernel 설치 지침을 따릅니다. 일반적으로 `make install`을 실행합니다.

Samba 4.x source tree와 CIFS VFS web site에서 제공하는 `mount.cifs` utility가 없다면 다른 mount helper가 있는 directory, 보통 `/sbin`에 복사합니다. Helper가 필수는 아니지만 `mount.cifs` 사용을 권장합니다. 대부분의 distribution은 이 utility를 포함한 `cifs-utils` package를 제공하므로 해당 package를 설치하는 것이 좋습니다.

모든 Linux client에서 Winbind pam/nss module인 logon service를 실행하면 domain 전체의 UID와 GID를 올바른 network user에 일관되게 mapping하는 데 유용합니다. `mount.cifs` mount helper는 `git.samba.org`의 `cifs-utils.git`에서 찾을 수 있습니다.

`cifs`를 module로 build하면 network buffer의 크기와 수, 한 server로 동시에 보낼 수 있는 최대 request 수를 구성할 수 있습니다. 기본값 변경은 권장하지 않습니다. 다음 명령으로 `kernel/fs/smb/client/cifs.ko`가 `insmod cifs.ko` 초기화 시 받을 수 있는 구성 parameter 목록을 확인할 수 있습니다.

	modinfo <path to cifs.ko>
CIFS 설치 방식
Build 형태설치 방법주요 결과
Loadable module`make modules_install``cifs.ko` in /lib/modules
Built-in`make install`새 kernel image
User space helperInstall `cifs-utils``mount.cifs` in /sbin
Module inspection`modinfo <path to cifs.ko>`초기화 parameter 목록

Build 형태에 따라 설치 명령과 결과 위치가 달라집니다.

안전한 dialect와 POSIX option 권장사항

74-87

보안을 높이기 위해 SMB2.1 이상을 사용하며, 일반적으로 SMB3.1.1이 협상되는 것이 새로운 기본값입니다. Windows XP 같은 오래된 system을 mount하려면 `vers=1.0`을 사용하고, Windows Vista에는 `vers=2.0`을 사용할 수 있습니다.

CIFS인 `vers=1.0`은 기본 dialect인 SMB3보다 훨씬 오래됐고 보안성이 낮습니다. SMB3에는 downgrade attack 탐지, encrypted share, 더 강한 signing 및 authentication algorithm 같은 고급 security 기능이 포함됩니다.

SMB3에서 POSIX 동작을 개선하려면 `mfsymlinks`와 함께 `cifsacl` 또는 `modefromsid`를 사용하며, 일반적으로 `idsfromsid`도 같이 사용합니다. `vers=3`으로 SMB3 이상을 강제할 수 있지만 `vers=2.1`은 강제하지 않는다는 원문의 주의사항을 따릅니다.

Dialect와 보안 권장값
대상Mount option보안 및 기능
Windows XP`vers=1.0`Legacy CIFS, 보안성이 낮음
Windows Vista`vers=2.0`Legacy compatibility
Modern serverDefault or `vers=3`SMB3.1.1 협상 가능
POSIX behavior`mfsymlinks`, `cifsacl` 또는 `modefromsid`, `idsfromsid`Symlink와 identity mapping 개선

호환성 목적의 legacy 설정과 권장 modern 설정을 구분합니다.

일반 사용자의 mount 허용

88-114

CIFS VFS에서는 사용자가 소유한 directory 위에 share를 mount하고 unmount하도록 허용할 수 있습니다. 한 가지 방법은 `chmod +s /sbin/mount.cifs`처럼 `mount.cifs` utility에 suid를 설정하는 것입니다.

사용자가 자신이 mount한 share를 unmount하려면 `mount.cifs` version 1.4 이상이 필요하고, `/etc/fstab`에 사용자가 unmount할 수 있음을 나타내는 share entry가 있어야 합니다.

     //server/usersharename  /mnt/username cifs user 0 0

`mount.cifs`를 suid로 실행해 user mount를 허용할 때는 위험을 줄이기 위해 `nosuid` mount flag를 전달합니다. 따라서 remote target에 있는 suid program 실행을 막습니다. Root가 mount하면 기본적으로 `nosuid`를 전달하지 않으므로 remote target의 suid program 실행이 허용됩니다. NFS 등 다른 filesystem과 마찬가지로 mount option에 `nosuid`를 명시해 바꿀 수 있습니다.

User mount에서 반대로 `suid` flag를 전달할 수 있게 하려면 `CIFS_ALLOW_USR_SUID` flag를 사용해 `mount.cifs`를 다시 build해야 합니다. CIFS mount의 대응 manual page는 Samba 3.0 이상 source tree의 `docs/manpages/mount.cifs.8`에 있습니다.

User mount 허용 절차
mount.cifs 1.4+Set suid on helperAdd user entry to /etc/fstabUser mounts owned directorynosuid applied

Helper 권한, fstab policy와 자동 nosuid 적용의 관계입니다.

User mount의 suid 처리
상황기본 동작변경 방법
Suid mount.cifs로 user mount`nosuid` 전달`CIFS_ALLOW_USR_SUID`로 rebuild
Root mount`nosuid` 미전달Mount option에 `nosuid` 명시
Remote programUser mount에서는 suid 실행 금지명시적 policy 필요

실행 주체와 build option에 따라 remote suid program 허용 여부가 달라집니다.

일반 사용자의 unmount 허용

115-135

사용자가 자신이 user mount한 directory를 unmount하도록 하려면 `umount.cifs` utility를 사용할 수 있습니다. 직접 실행하거나 `/sbin`에 두면 대부분의 `umount` version이 CIFS mount를 해제할 때 이 helper를 호출합니다. 다만 `umount`에 `-i`를 지정하면 unmount helper를 호출하지 않습니다.

`mount.cifs`와 마찬가지로 user unmount를 허용하려면 `chmod +s /sbin/umount.cifs`처럼 `umount.cifs`에 suid 또는 동등한 권한을 부여해야 합니다. 일부 distribution에서는 `/etc/permissions` file에 entry를 추가해 같은 효과를 냅니다.

Utility가 성공하려면 target path가 CIFS mount여야 하고, 현재 user의 UID가 resource를 mount한 user의 UID와 일치해야 합니다.

일반적인 방법은 `mount.cifs`와 `unmount.cifs`를 suid로 사용하기보다 mount할 각 `//server/share`에 대해 `/etc/fstab`에 한 줄씩 추가하는 것입니다. 그러나 잠재적인 mount target이 많거나 UNC 이름을 예측하기 어려우면 관리하기 불편해질 수 있습니다.

User unmount 검증
umount request`-i` not setInvoke /sbin/umount.cifsTarget is CIFS mountCurrent UID matches mounting UIDUnmount

Helper 호출과 ownership 검사를 모두 통과해야 합니다.

Samba Unix Extensions, xattr와 server 설정

136-167

현재 server 대부분은 보안성이 더 높은 SMB2.1과 SMB3를 지원합니다. 그러나 오래되고 보안성이 낮은 CIFS dialect에도 유용한 protocol extension이 있으므로 CIFS/SMB1으로 mount하면서 최대 기능을 얻으려면 SNIA CIFS Unix Extensions 표준을 지원하는 server를 권장합니다. Samba 2.2.5 이상 대부분이 이에 해당하며, CIFS VFS 자체는 다양한 CIFS server와 동작합니다.

Samba 2.2.5 이상처럼 CIFS Unix extensions를 지원하는 server가 아니면 UID, GID와 file permission이 기본값으로 표시됩니다. Samba server의 `smb.conf`에 다음 설정을 추가해 Unix CIFS Extensions를 활성화합니다.

	unix extensions = yes

Client 대부분이 Unix 또는 Linux라면 Samba server의 `smb.conf`에 다음 설정도 유용합니다.

	case sensitive = yes
	delete readonly = yes
	ea support = yes

Linux CIFS client에서 xattr를 지원하려면 server의 EA support가 필요합니다. Samba 3.0.6 이상에는 EA support가 있고, Windows의 NTFS filesystem share에서도 EA가 동작합니다. Extended Attribute인 xattr는 대부분 Linux filesystem의 선택 기능이므로 `make menuconfig`에서 활성화해야 할 수 있습니다. Client의 user xattr 지원은 mount별로 `nouser_xattr`를 지정해 비활성화할 수 있습니다.

Unix-oriented Samba 설정
smb.conf 또는 mount 설정효과
`unix extensions = yes`UID, GID, mode 및 Unix semantics
`case sensitive = yes`Case-sensitive 이름 처리
`delete readonly = yes`Read-only file 삭제 policy
`ea support = yes`Linux client xattr 지원
Mount `nouser_xattr`Client user xattr 비활성화

CIFS Unix Extensions와 Linux client의 metadata 동작에 필요한 항목입니다.

xattr 지원 경로
Server ea supportSMB EA operationCIFS client XATTR supportLocal VFS xattr
Mount nouser_xattrDisable user xattr for this mount

Server EA와 client filesystem 설정이 함께 준비돼야 합니다.

Mount syntax와 credential 전달

203-251

CIFS VFS support를 kernel에 built-in하거나 `cifs.ko` module로 설치한 뒤 다음 mount syntax로 Samba, Mac 또는 Windows server에 접근할 수 있습니다.

  mount -t cifs //9.53.216.11/e$ /mnt -o username=myname,password=mypassword

`-o` 앞에 `-v`를 지정하면 `mount.cifs` mount helper가 mount 단계를 더 자세히 표시합니다. `-o` 뒤에는 다음과 같이 자주 사용하는 CIFS VFS 전용 option을 지정합니다.

  username=<username>
  password=<password>
  domain=<domain name>

다른 CIFS mount option은 뒤에서 설명합니다. `mount.cifs`가 설치돼 있으면 IP address뿐 아니라 TCP name도 사용할 수 있습니다. Mount한 server를 신뢰하지 않거나 CIFS signing이 꺼져 있고 physical network도 안전하지 않다면, hostile server나 router가 변경한 binary를 local system에서 실행할 위험을 줄이도록 표준 mount option `noexec`와 `nosuid` 사용을 검토하십시오.

`mount.cifs`는 아직 CIFS URL specification 형식으로 mount할 수 없지만, 널리 쓰는 UNC 형식 `\\server\share` 대신 NFS style과 비슷한 `server:share` 대체 형식을 사용할 수 있습니다.

  mount -t cifs tcp_name_of_server:share_name /mnt -o user=myname,pass=mypasswd

`mount.cifs`를 사용할 때 command line의 일반 `pass=` syntax로 `-o` 뒤에 password를 직접 지정하는 대신 다른 방법을 사용할 수 있습니다.

  • 1) Mount option에 `credentials=filename`을 넣고 credential file을 사용합니다. File에는 username과 password 두 줄이 들어갑니다.
  • 2) `PASSWD` environment variable로 password를 지정합니다. 같은 방식으로 `USER` environment variable에서 user name을 가져올 수 있습니다.
  • 3) `PASSWD_FILE`로 이름을 지정한 file에서 password를 읽습니다.
  • 4) `PASSWD_FD`로 file descriptor를 지정해 password를 읽습니다.
	username=someuser
	password=your_password

Password를 제공하지 않으면 `mount.cifs`가 password 입력을 요청합니다.

CIFS mount 입력
분류예시역할
Target`//9.53.216.11/e$` 또는 `server:share`Remote share
Identity`username`, `password`, `domain`SMB session
Helper`-v`Mount 단계 상세 출력
Local safety`noexec`, `nosuid`변조 binary와 suid 실행 위험 완화

Server 위치, session identity와 local security option을 분리해 확인합니다.

Password 공급 우선 경로
credentials fileusername + passwordmount.cifs
PASSWD environmentmount.cifs
PASSWD_FILEmount.cifs
PASSWD_FDmount.cifs
No password sourceInteractive promptmount.cifs

Command line 노출을 피할 수 있는 대체 credential source입니다.

Transport와 filename 제한

252-275

Server는 `pure-TCP`, 즉 port 445의 TCP/IP CIFS connection 또는 RFC 1001/1002의 `Netbios-Over-TCP/IP` 중 하나를 지원해야 합니다. Server 대부분이 이를 지원하므로 일반적으로 문제가 되지 않습니다.

Windows와 Linux의 valid filename 규칙은 다릅니다. Windows는 stream name 시작을 구분하는 colon(`:`) 같은 예약 문자가 포함된 filename을 보통 제한하지만 Linux는 조금 더 넓은 문자 집합을 허용합니다. Windows server registry에 명시적 mapping을 설정하면 이러한 문자를 remap할 수 있습니다.

Samba 3.10부터는 server에 Unix Extensions를 구성하고 client가 `/proc/fs/cifs/LinuxExtensionsEnabled`를 비활성화하지 않았다면, Windows/CIFS semantics에서는 금지되지만 Linux에서는 valid한 문자를 포함하는 filename을 허용합니다.

CIFS `vers=1.0`에서는 mount option `mapposix`로 Windows, NTFS, SMB에서 금지된 문자를 remap 범위로 강제 mapping할 수 있습니다. SMB3에서는 이 mount parameter가 기본값입니다. `mapposix` remap 범위는 Mac과 일부 오래된 Windows의 `Services for Mac`과도 호환됩니다.

SMB 3.1.1 POSIX Extensions가 협상되면 remapping은 자동으로 비활성화됩니다.

Filename remapping 조건
조건동작
Windows server registry mapping예약 문자를 명시적으로 remap
Samba 3.10+와 Unix ExtensionsLinux-valid filename 허용
CIFS `vers=1.0` + `mapposix`금지 문자를 POSIX-compatible 범위로 remap
SMB3`mapposix`가 기본
SMB 3.1.1 POSIX ExtensionsRemapping 자동 비활성화

Dialect와 extension 협상 결과에 따라 문자 mapping이 달라집니다.

Session identity, inode owner와 기본 mode

276-340

다음은 지원하는 CIFS VFS mount option의 일부입니다. `username`은 CIFS session을 수립할 때 사용할 user name이고, `password`는 user password입니다. Mount helper가 설치돼 있고 password를 제공하지 않으면 입력을 요청합니다. `ip`는 target server의 IP address이며 `unc`는 mount할 target server의 Universal Network Name export입니다. `domain`은 CIFS session 수립 중 username 앞에 붙일 SMB/CIFS workgroup 이름을 설정합니다.

`forceuid`는 inode의 default UID를 mount 때 전달한 UID로 설정합니다. 올바르게 구성된 Samba처럼 CIFS Unix extensions를 지원하는 server는 UID, GID와 mode를 제공하므로 server와 client의 UID/GID numbering이 다른 경우가 아니면 이 parameter를 지정하지 않아야 합니다. Server와 client가 같은 domain에서 `winbind` 또는 `nss_ldap`을 실행하고 server가 Unix Extensions를 지원하면 UID와 GID를 server에서 가져올 수 있어 mount에 따로 지정할 필요가 없습니다.

Windows처럼 CIFS Unix extensions를 지원하지 않거나 UID/GID owner를 보고하지 않는 server에서는 `uid=` 또는 `gid=` option을 지정하지 않으면 기존 file lookup의 기본 UID/GID가 mount를 실행한 사람의 UID/GID가 됩니다. User mount용 `mount.cifs`가 setuid로 구성되지 않았다면 보통 root입니다. File 접근 authorization은 server에서 검사하지만 관리자가 client에서도 제한하고 싶을 수 있습니다. 이런 server에서는 `file_mode`와 `dir_mode`를 지정해 단순한 client-side permission 검사를 활성화할 수 있습니다.

`forcegid`는 UID 대신 group ID에 적용하는 `forceuid`와 같은 option입니다. `noforceuid`는 가능하면 server에 요청해 file owner UID를 채우며, server가 inode UID를 반환할 수 없을 때만 mount의 `uid=` 값을 사용합니다. `noforcegid`도 같은 방식으로 group owner GID에 적용됩니다.

`uid`는 inode의 default UID를 설정하고 어떤 local user가 mount했는지를 CIFS kernel driver에 알립니다. Server가 Unix extensions를 지원하면 `forceuid`를 지정하지 않는 한 이 default UID로 inode owner field를 채우지 않습니다. `gid`는 inode의 default GID를 같은 방식으로 설정합니다. Server가 CIFS Unix extensions를 지원하지 않으면 `file_mode`가 file inode의 default mode를 덮어씁니다.

Session과 target option
Option의미
`username`CIFS session user name
`password`User password 또는 helper prompt
`ip`Target server IP address
`unc`Mount할 Universal Network Name export
`domain`Username 앞에 붙이는 SMB/CIFS workgroup

Remote endpoint와 SMB session identity를 구성하는 기본 option입니다.

UID, GID와 mode 결정
조건 또는 optionUID/GID 및 mode 출처
Unix Extensions + defaultServer가 UID, GID, mode 제공
`forceuid`, `forcegid`Mount에서 지정한 local value 강제
`noforceuid`, `noforcegid`Server value 우선, 불가능하면 mount value
No Unix ExtensionsMounter UID/GID 또는 `uid=`, `gid=`
`file_mode`, `dir_mode`Server가 mode를 제공하지 않을 때 client 기본 mode

Unix Extensions 협상 여부와 force option이 inode metadata 출처를 결정합니다.

FS-Cache, transfer size와 attribute cache

341-392

`fsc`는 기본적으로 꺼진 FS-Cache 기반 local disk caching을 활성화합니다. 느린 link, 부하가 큰 server 또는 network에서 server보다 disk read가 빠를 때 성능을 높이고 server call 수를 줄여 확장성을 개선할 수 있습니다. 그러나 read-once workload처럼 local caching이 맞지 않는 경우도 있으므로 workload와 scenario를 신중히 검토해야 합니다. 현재 local disk caching은 read-only로 연 CIFS file에서 동작합니다.

Server가 CIFS Unix extensions를 지원하지 않으면 `dir_mode`가 directory inode의 default mode를 덮어씁니다. `port`는 일반 port인 445, 이어서 139를 시도하기 전에 지정한 TCP port로 server에 접속하도록 합니다.

`iocharset`은 local path name을 Unicode로 변환하거나 Unicode에서 되돌릴 때 사용할 codepage입니다. Server가 지원하면 network path name에 기본적으로 Unicode를 사용합니다. `iocharset`을 지정하지 않으면 local client kernel build 때 정한 `nls_default`를 사용하며, server가 Unicode를 지원하지 않으면 이 parameter를 사용하지 않습니다.

`rsize`는 default read size이며 보통 16K입니다. Client는 `CIFSMaxBufSize`보다 큰 `rsize`를 쓸 수 없습니다. `CIFSMaxBufSize` 기본값은 16K이고 `cifs.ko` 설치 때 8K부터 kernel이 허용하는 최대 `kmalloc` size까지 바꿀 수 있습니다. 너무 큰 값은 memory 사용을 늘리고 경우에 따라 성능을 낮출 수 있습니다.

원래 CIFS protocol 최대값인 127K보다 큰 `rsize`를 사용하려면 server가 very large read용 새 Unix Capability flag도 지원해야 합니다. Samba 3.0.26 이상 같은 일부 새 server가 이를 지원합니다. `rsize` 범위는 최소 2048부터 최대 130048이며, 실제 최대값은 127K와 `CIFSMaxBufSize` 중 작은 값입니다.

`wsize`는 default write size로 57344입니다. 현재 CIFS가 허용하는 최대 `wsize`도 57344이며 이는 4096-byte page 14개입니다.

`actimeo=n`은 초 단위 attribute cache timeout이며 기본값은 1초입니다. Timeout 뒤 CIFS client가 server에 새 attribute 정보를 요청합니다. 짧은 timeout은 cache coherency를 높이지만 server call이 늘고, 긴 timeout은 call을 줄이는 대신 잠깐 잘못된 attribute cache가 남을 수 있어 coherency 검사가 느슨해집니다.

CIFS cache와 I/O size option
Option기본값 또는 범위주요 고려사항
`fsc`OffRead-only file local disk cache
`rsize`보통 16K, 2048..130048`CIFSMaxBufSize`와 server capability 제한
`wsize`57344최대 14 x 4096-byte pages
`actimeo=n`1 second짧으면 coherency, 길면 server call 감소
`iocharset``nls_default`Local path와 Unicode 변환
`port`445, then 139지정 port를 먼저 시도

성능 향상과 coherency, memory 사용 사이의 tradeoff입니다.

Read/write mode, separator, 실행 policy와 helper option

393-445

`rw`는 network share를 read-write로 mount하지만 server가 여전히 share를 read-only로 판단할 수 있습니다. `ro`는 read-only mount입니다. `version`은 mount helper utility의 서로 다른 version을 구분하는 데 쓰며 일반적으로 필요하지 않습니다.

`sep`을 `-o` 뒤의 첫 mount option으로 지정하면 mount parameter separator인 comma를 다른 문자로 바꿉니다. 일반 형식은 다음과 같습니다.

			-o user=myname,password=mypassword,domain=mydom

Username, password 또는 domain에 comma가 포함됐을 때 period를 separator로 사용하려면 다음과 같이 전달할 수 있습니다.

			-o sep=.user=myname.password=mypassword.domain=mydom

CIFS mount helper `cifs.mount` version 1.1 이상을 사용하면 `sep`의 중요성은 낮습니다.

`nosuid`는 remote executable의 suid bit 실행을 막습니다. CIFS Unix Extensions를 지원하는 Samba 같은 server mount에서만 의미가 있으며, network의 mount target을 신뢰하지 않는다면 보안을 위해 권장합니다. `exec`는 mount의 binary 실행을 허용하고 `noexec`는 금지합니다. `dev`는 remote mount의 block device를 인식하고 `nodev`는 인식하지 않습니다. `suid`는 mountpoint의 suid-enabled remote file 실행을 허용합니다. Root mount에서는 이것이 기본이고 user mount에서는 `nosuid`가 기본입니다.

`credentials`는 CIFS kernel component가 무시하지만 `mount.cifs` helper가 사용합니다. Helper는 지정한 credential file을 열어 user ID와 password argument를 읽고 CIFS VFS로 전달합니다. `guest`도 kernel component는 무시하지만, mount option에 지정하면 `mount.cifs`가 password를 묻지 않습니다. Password를 따로 지정하지 않으면 null password를 사용합니다.

Mountpoint 실행 및 device policy
Option pair허용차단
Read/write`rw``ro`
Executable`exec``noexec`
Device`dev``nodev`
Suid`suid``nosuid`

Local VFS가 remote object를 어떻게 취급할지 지정합니다.

Credential helper 경로
`credentials=FILE`mount.cifs reads user/passwordPass arguments to CIFS VFSEstablish session
`guest`Skip promptUse null password when unspecified

Kernel이 직접 해석하지 않는 option을 mount.cifs가 session argument로 바꿉니다.

Client permission, inode number와 create owner

446-506

`perm`은 client에서 file UID/GID를 mode 및 원하는 operation과 비교하는 `vfs_permission` 검사를 수행합니다. Target machine의 server software가 수행하는 일반 ACL 검사에 추가되는 검사이며 기본적으로 활성화됩니다.

`noperm`은 client permission 검사를 끕니다. 이 때문에 local client system의 다른 user가 mount의 file에 접근할 수 있습니다. 보통 server가 CIFS Unix Extensions를 지원하지만 client와 server의 UID/GID가 충분히 일치하지 않아 mount user가 접근하지 못할 때만 필요합니다. CIFS Unix Extensions가 없는 mount에서도 mount에 default mode를 지정했지만 client에서 강제하고 싶지 않을 때, 예를 들어 `MultiUserMount`가 활성화된 경우 유용할 수 있습니다. 이 option은 mount 때 제공한 username에 대해 server ACL을 검사하는 정상 server-side ACL 검사에는 영향을 주지 않습니다.

`serverino`는 client에서 자동 증가 inode number를 만들지 않고 server의 inode number를 사용합니다. Hardlink file은 같은 inode number를 가지므로 찾기 쉽고 inode number가 지속될 수 있습니다. 그러나 한 share 아래 여러 server-side mount를 export하면 서로 다른 filesystem의 inode number가 겹칠 수 있어 server가 uniqueness를 보장하지 않습니다.

Windows 2000 이전 같은 일부 오래된 server는 UniqueID 또는 CIFS Unix Extensions의 동등 기능을 반환하지 않아 `serverino`가 효과가 없습니다. CIFS mount를 `nfsd` 아래 export하려면 CIFS mount에 이 option이 필요합니다. 현재는 server가 필요한 network operation을 지원할 때 `serverino`가 기본값입니다.

`noserverino`는 실제 server inode number 대신 client가 inode number를 생성합니다. 이 값은 unmount 또는 reboot 뒤 바뀌어 일부 application을 혼란스럽게 할 수 있지만 모든 server filesystem이 unique inode number를 지원하는 것은 아닙니다.

`setuids`는 server와 CIFS Unix extensions를 협상했을 때 새 file, directory, device를 `create`, `mkdir`, `mknod`하면서 local process의 effective UID와 GID를 설정하려고 합니다. Extensions를 협상하지 못하면 mount의 default UID/GID 대신 새 file의 UID/GID를 local cache에 저장하므로 inode reload 또는 share remount 때 file UID가 바뀔 수 있습니다.

`nosetuids`는 새 file, directory, device의 UID/GID를 client가 설정하지 않습니다. 이 경우 server가 default UID/GID, 보통 share를 mount한 user의 server UID를 설정하며 이것이 기본 동작입니다. CIFS Unix Extensions를 협상하지 못하면 새 file의 UID/GID는 mounter의 값 또는 mount의 `uid`와 `gid` parameter로 보입니다.

Permission 검사 위치
OptionClient 검사Server ACL 검사
`perm`Enabled, default항상 유지
`noperm`Disabled항상 유지

Client mode 검사와 server ACL 검사는 서로 독립적입니다.

Inode와 create ownership
Option동작주의점
`serverino`Server inode number 사용한 share 아래 여러 filesystem은 충돌 가능
`noserverino`Client inode number 생성Unmount/reboot 뒤 값 변경
`setuids`Create 때 local effective UID/GID 설정No Unix Extensions에서는 local cache
`nosetuids`Server가 UID/GID 설정, defaultMounter 또는 mount parameter로 표시

Identity가 지속되는 위치와 기본 동작을 비교합니다.

NetBIOS, page cache, ACL, xattr와 character mapping

507-559

`netbiosname`은 port 139로 server를 mount할 때 RFC1001 NetBIOS session 초기화에서 client NetBIOS machine name을 나타내는 RFC1001 source name을 지정합니다.

`direct`는 이 mount에서 연 file의 inode data caching을 하지 않으며 memory mapping도 사용할 수 없게 합니다. Fast network에서 client cache 이점이 거의 없거나, application이 같은 data를 다시 읽지 않고 page보다 큰 sequential read를 수행하는 경우에는 기본 page cache 동작보다 빠를 수 있습니다. 기본 동작은 oplock caching token을 받아 보유하면 local Linux client page cache를 통해 read-ahead와 write-behind를 수행합니다. `direct`는 page size보다 큰 write를 server에 보낼 수 있게 합니다.

`strictcache`는 strict cache mode를 켭니다. Client가 Oplock Level II를 가진 동안에는 항상 cache에서 읽고, 그렇지 않으면 server에서 읽습니다. 모든 write data는 cache에 저장하지만 Exclusive Oplock이 없으면 server에도 씁니다.

`rwpidforward`는 file을 연 process의 PID를 해당 file의 모든 read/write operation에 전달합니다. Mandatory `brlock` style을 사용할 때 WINE 같은 application의 read/write 실패를 막습니다.

`acl`은 server가 지원하면 `setfacl`과 `getfacl`로 POSIX ACL을 관리하도록 허용하며 기본값입니다. `noacl`은 이 mount에서 두 call을 허용하지 않습니다. `user_xattr`은 이름이 `user.` 또는 `os2.`로 시작하는 user xattr를 server의 OS/2 EA로 읽고 설정할 수 있게 하며 `setfattr`와 `getfattr`를 지원합니다. 이것도 기본값입니다. `nouser_xattr`는 `getfattr`와 `setfattr`의 xattr get/set/list를 허용하지 않습니다.

`mapchars`는 backslash를 제외한 7개 예약 문자 중 6개를 0xF000 위의 remap 범위로 변환합니다.

			*?<>|:

이 mapping으로 CIFS client는 Windows POSIX emulation이 해당 문자를 사용해 만든 file을 인식할 수 있습니다. 이런 7개 문자가 포함된 이름의 생성과 open을 금지하는 대부분의 Samba version을 mount할 때도 유용합니다. Server가 wire에서 Unicode를 지원하지 않으면 효과가 없습니다. `nomapchars`는 이 7개 문자를 변환하지 않으며 기본값입니다.

Data access와 metadata option
Option동작Default
`direct`Page cache와 mmap 비활성화No
`strictcache`Oplock 수준에 따른 strict cacheNo
`rwpidforward`Open process PID를 I/O에 전달No
`acl` / `noacl`POSIX ACL tool 허용 또는 차단`acl`
`user_xattr` / `nouser_xattr`User xattr 허용 또는 차단`user_xattr`
`mapchars` / `nomapchars`Reserved character remap`nomapchars`

Cache, ACL, xattr의 기본 동작을 정리했습니다.

Oplock과 cache 경로
Default + oplockLinux page cacheRead-ahead / write-behindServer
`direct`Bypass inode data cacheServer
`strictcache` + Level IIRead cacheServer when oplock absent

Default, direct, strictcache mode에서 I/O source가 달라집니다.

Case, POSIX path, Unix Extensions, locking과 fsync

560-610

`nocase`는 case-insensitive path name matching을 요청합니다. Server가 지원하면 case-sensitive가 기본입니다. Mount option `ignorecase`는 `nocase`와 같습니다.

`posixpaths`는 CIFS Unix extensions를 지원할 때 POSIX path name 지원 협상을 시도합니다. 일반 CIFS filename에서 금지되는 일부 문자를 remap 없이 사용할 수 있으며 기본값입니다. `noposixpaths`는 Unix extensions가 있어도 POSIX path name 지원을 요청하지 않으므로 server가 예약 문자가 포함된 file 생성을 거부할 수 있습니다.

`nounix`는 이 mount의 tree connection에서 CIFS Unix Extensions를 비활성화합니다. 드물게 필요하지만 POSIX ACL, POSIX lock, POSIX path, symlink, server의 UID/GID/mode 조회를 한 번에 끄거나 Unix Extensions를 잘못 구현한 server bug를 우회할 때 쓸 수 있습니다.

`nobrl`은 server에 byte-range lock request를 보내지 않습니다. CIFS style mandatory byte-range lock 때문에 깨지는 일부 application에 필요합니다. 대부분 CIFS server는 아직 advisory byte-range lock request를 지원하지 않습니다.

`forcemandatorylock`은 server가 POSIX advisory byte-range locking을 지원해도 mandatory lock request만 보냅니다. DOS/Windows용으로 작성돼 Windows style mandatory byte-range locking이 필요한 드문 application에 유용할 수 있습니다. 짧은 option 이름 `forcemand`도 허용합니다.

`nostrictsync`를 설정하면 application의 `fsync` call 때 CIFS client가 server의 모든 dirty data를 즉시 disk에 쓰게 하는 SMB Flush를 보내지 않습니다. 그래도 cached dirty file data는 모두 server에 보내고 write response를 기다립니다. SMB Flush가 매우 느리고 server가 충분히 신뢰할 만하다면 `fsync`를 지나치게 자주 호출하는 application의 성능을 높일 수 있지만 server crash 때 data risk가 조금 커집니다. 이 option을 설정하지 않으면 기본적으로 CIFS는 매 `fsync`마다 SMB Flush request를 보내고 response를 기다립니다.

Path와 locking option
Option효과
`nocase` / `ignorecase`Case-insensitive matching 요청
`posixpaths`POSIX path 협상, default
`noposixpaths`POSIX path 협상 안 함
`nounix`Tree connection의 Unix Extensions 전체 비활성화
`nobrl`Byte-range lock request를 보내지 않음
`forcemandatorylock` / `forcemand`Mandatory lock만 전송

Naming semantics와 byte-range lock policy를 구분합니다.

fsync 처리 비교
Default fsyncSend dirty cached dataWait write responseSend SMB FlushWait flush response
`nostrictsync` fsyncSend dirty cached dataWait write responseSkip SMB Flush

nostrictsync는 network write completion은 기다리지만 server disk flush는 생략합니다.

DFS, legacy compatibility, signing, encryption과 lease

611-666

`nodfs`는 server가 지원한다고 해도 DFS global namespace 지원을 비활성화합니다. Samba 3.0.24와 3.0.25의 DFS path parsing 문제를 우회하는 데 도움이 될 수 있습니다. `remount`는 share를 다시 mount하며 흔히 `ro`와 `rw` 사이를 바꿀 때 사용합니다.

`cifsacl`은 file의 Windows ACL을 바탕으로 `stat` 등에 표시할 mode bit를 보고하는 experimental option입니다. `servern`은 server session 설정에 사용할 server NetBIOS name인 RFC1001 이름을 지정합니다. OS/2, Windows 98, Windows ME처럼 default server name을 지원하지 않는 오래된 server 일부를 mount할 때 필요합니다. Server name은 최대 15자이고 보통 uppercase입니다.

`sfu`는 CIFS Unix Extensions를 협상하지 못했을 때 Services for Unix와 호환되는 형식으로 device file과 FIFO 생성을 시도합니다. SFU처럼 `SETFILEBITS` extended attribute로 mode bit 10-12도 가져옵니다. 향후에는 security descriptor ACL query로 하위 9개 mode bit도 emulation할 예정이라고 원문은 설명합니다.

`mfsymlinks`는 Minshall+French symlink 지원을 활성화합니다. 참조 URL은 `http://wiki.samba.org/index.php/UNIX_Extensions#Minshall.2BFrench_symlinks`입니다. `sfu`와 함께 지정하면 이 option을 무시합니다. Server가 CIFS Unix Extensions를 지원해도 Minshall+French symlink를 사용합니다.

`sign`은 packet signing을 반드시 사용하게 해 route의 intermediate system이 원치 않게 data를 변경하는 것을 막는 데 도움을 줍니다. Signing은 `lanman` 또는 plaintext authentication과 함께 동작하지 않습니다.

`seal`은 이 mount share의 모든 data를 network로 보내기 전에 반드시 seal, 즉 encrypt합니다. Unix Extensions 지원이 필요합니다. `sign`과 달리 이 mount share의 data만 암호화하며 같은 server의 다른 mount share에는 영향을 주지 않습니다.

`locallease`는 드물게 필요한 experimental option입니다. Samba와 NFSv4 server 같은 application은 `fcntl F_SETLEASE`로 file cache 가능 여부를 확인합니다. CIFS는 명시적으로 lease를 요청할 수 없지만 file이 cache 가능한 oplock 상태인지 확인할 수 있습니다. Oplock이 없어도 server가 oplock을 지원하지 않고 update가 이 client에서만 일어난다고 확신하는 경우처럼, 다른 local process가 file을 쓰지 않으면 cache 가능할 수 있습니다. 이 option은 oplock이 없는 file에 lease를 거부하는 대신 CIFS client가 local process만 기준으로 lease를 검사하게 합니다.

Protocol compatibility option
Option용도
`nodfs`DFS global namespace 비활성화
`remount`Share를 다시 mount하고 ro/rw 변경
`cifsacl`Windows ACL 기반 mode bit, experimental
`servern`최대 15자의 RFC1001 server NetBIOS name
`sfu`Services for Unix device, FIFO와 mode emulation
`mfsymlinks`Minshall+French symlink

Legacy server와 namespace, metadata compatibility를 위한 option입니다.

Signing, sealing과 local lease
Option보장 또는 동작범위 및 제약
`sign`Packet integrityLanman/plaintext auth와 호환되지 않음
`seal`Share data encryption해당 mount share만 영향
`locallease`Oplock 없는 file의 local lease 검사Experimental

Integrity, confidentiality와 local cache 판단을 구분합니다.

Authentication mode, retry와 mount.cifs flag

667-707

`sec`는 security mode를 지정합니다. 허용값은 다음과 같습니다.

CIFS sec mode
Value동작
`none`이름 없는 null user로 connection 시도
`krb5`Kerberos version 5 authentication
`krb5i`Kerberos authentication과 packet signing
`ntlm`NTLM password hashing, default
`ntlmi`NTLM password hashing과 signing. `/proc/fs/cifs/PacketSigningEnabled`가 켜졌거나 server가 signing을 요구하면 default일 수 있음
`ntlmv2`NTLMv2 password hashing
`ntlmv2i`NTLMv2 password hashing과 packet signing
`lanman`Kernel config에 포함됐을 때 오래된 LANMAN hash

Authentication mechanism과 packet signing 조합입니다.

`hard`는 server가 응답하지 않을 때 file operation을 재시도합니다. `soft`는 응답하지 않는 server에 대한 재시도를 보통 한 번으로 제한한 뒤 error를 반환하며 기본값입니다.

Unresponsive server retry
`hard`Server unresponsiveRetry file operation
`soft`Server unresponsiveUsually one retryReturn error

Application 대기와 빠른 error 반환 사이의 선택입니다.

`mount.cifs` mount helper는 `-o` 앞에 다음 option도 받습니다.

mount.cifs helper flag
Flag동작
`-S`stdin에서 password를 읽음, `PASSWD_FD=0`과 같음
`-V``mount.cifs` version 출력
`-?`간단한 usage 정보 표시

Source의 ASCII 표를 같은 의미의 구조화 table로 옮겼습니다.

대부분의 2.6 kernel용 `modutils`에서는 `modinfo`로 CIFS kernel module version을 표시할 수 있습니다.

/proc/fs/cifs informational pseudo-file

708-721

`/proc/fs/cifs` 아래의 informational pseudo-file은 active session, share, open handle, 통계와 mount parameter를 관찰하는 read interface입니다.

/proc/fs/cifs informational files
File표시 내용
`DebugData`Active CIFS session과 share, enabled feature, `cifs.ko` version
`Stats`Resource usage 요약과 share별 통계
`open_files`모든 active SMB session의 열린 file handle
`mount_params`Module에서 사용할 수 있는 모든 mount parameter

Source의 ASCII 표를 각 pseudo-file의 관찰 범위로 구조화했습니다.

SecurityFlags, cifsFYI와 runtime configuration

722-788

`SecurityFlags`는 security negotiation과 packet signing을 제어합니다. NTLMv2 같은 authentication의 `may` 또는 `must` flag를 signing flag와 조합할 수 있습니다. 반면 서로 다른 password hashing mechanism 두 개를 모두 `must use`로 지정하는 것은 의미가 거의 없습니다. 기본 flag 값은 다음과 같습니다.

				0x00C5

기본값 `0x00C5`는 NTLMv2와 packet signing을 허용합니다. 일부 `SecurityFlags`는 대응하는 `menuconfig` option을 활성화해야 합니다.

SecurityFlags bit
PolicyValue
May use packet signing`0x00001`
Must use packet signing`0x01001`
May use NTLMv2`0x00004`
Must use NTLMv2`0x04004`
May use Kerberos security (`krb5`)`0x00008`
Must use Kerberos`0x08008`
May use NTLMSSP`0x00080`
Must use NTLMSSP`0x80080`
Seal, packet encryption`0x00040`
Must seal`0x40040`

Authentication, signing과 encryption의 may/must bit 조합입니다.

`cifsFYI`를 0이 아닌 값으로 설정하면 추가 debug 정보를 system error log에 기록합니다. 세 bit가 서로 다른 debug entry class를 제어하며 최대값 7은 모든 debug point를 켭니다. 기본값은 0입니다. 일부 debug statement는 kernel configuration에서 `CONFIG_CIFS_DEBUG2`를 활성화해야 CIFS kernel에 compile됩니다.

cifsFYI debug bit
Bit기록 내용조건
`0x01`CIFS informational message항상 사용 가능
`0x02`CIFS entry point의 return code항상 사용 가능
`0x04`1초보다 느린 response`.config`에서 `CONFIG_CIFS_STATS2` 필요
`7`세 class 모두해당 compile option에 따른 범위

Source의 ASCII bitmask 표를 같은 의미의 구조화 table로 옮겼습니다.

`traceSMB`를 1로 설정하면 SMB request와 response 시작을 포함한 debug 정보를 system error log에 기록합니다. 기본값은 0입니다. `LookupCacheEnable`을 1로 설정하면 inode 정보를 1초 동안 cache해 lookup 성능을 개선하며 기본값은 1입니다.

`LinuxExtensionsEnabled`를 1로 설정하면 client가 선택적 protocol 개선인 CIFS `UNIX` extensions 사용을 시도합니다. 이 extension으로 CIFS server가 정확한 UID/GID를 반환하고 symbolic link도 지원할 수 있습니다. Samba처럼 지원 server를 사용하지만 symlink 지원을 쓰지 않고 실제 owner 대신 mount에서 제공한 UID/GID로 field를 mapping하려면 0으로 설정합니다. 기본값은 1입니다.

`dfscache`는 DFS cache 내용을 나열합니다. 0으로 설정하면 client가 cache를 비웁니다.

/proc/fs/cifs configuration files
FileDefault동작
`SecurityFlags``0x00C5`Authentication, signing, sealing policy
`cifsFYI``0`Bitmask debug logging
`traceSMB``0`SMB request/response 시작 trace
`LookupCacheEnable``1`Inode lookup를 1초 cache
`LinuxExtensionsEnabled``1`CIFS UNIX extensions 협상
`dfscache`Read listWrite 0 to clear DFS cache

주요 runtime control과 기본값을 정리했습니다.

Runtime tracing과 share별 statistics

789-820

CIFS module을 설치하거나 kernel에 built-in한 뒤, 예를 들어 `insmod cifs` 뒤에 `/proc/fs/cifs` flag를 바꿔 experimental feature와 tracing을 활성화할 수 있습니다. Feature를 켜려면 값을 1로 설정합니다. Kernel message log tracing의 모든 `cifsFYI` bit를 켜는 예는 다음과 같습니다.

	echo 7 > /proc/fs/cifs/cifsFYI

`cifsFYI`는 bitmask입니다. 1은 여러 informational message의 추가 kernel logging, 2는 0이 아닌 SMB return code logging, 4는 byte-range lock request를 제외하고 완료에 1초 넘게 걸린 request logging을 활성화합니다. 4를 사용하려면 kernel `.config`에 `CONFIG_CIFS_STATS2`를 설정해야 합니다. 7은 세 기능을 모두 켭니다.

SMB request와 response 시작 trace는 다음과 같이 활성화합니다.

	echo 1 > /proc/fs/cifs/traceSMB

Share별, 즉 client mount별 통계는 `/proc/fs/cifs/Stats`에서 확인합니다. Kernel `.config`에 `CONFIG_CIFS_STATS2`를 활성화하면 추가 정보가 제공됩니다. 통계에는 read, write, close 같은 request type별로 시도한 SMB3 또는 CIFS request 수와 server가 0이 아닌 return code를 보낸 실패 수가 포함됩니다.

해당 share에서 server로 읽고 쓴 총 byte도 기록합니다. Client caching 영향 때문에 이 값은 client application이 읽고 쓴 byte 수보다 적을 수 있습니다. 두 scenario의 성능을 비교할 때 유용하도록 `echo 0 > /proc/fs/cifs/Stats`로 통계를 0으로 reset할 수 있습니다.

`cat /proc/fs/cifs/DebugData`는 active session과 mount된 share 정보를 표시합니다.

CIFS runtime trace 활성화
Load or build in cifsWrite cifsFYI bitmaskKernel informational/return/slow logs
Write traceSMB=1Trace SMB request and response start
Enable CONFIG_CIFS_STATS2Extended per-share counters

Procfs bit를 바꾸면 kernel log와 statistics 관찰 범위가 확장됩니다.

Share별 Stats 해석
Counter의미
Attempted requestRequest type별 SMB3/CIFS 시도 횟수
Failed requestServer가 non-zero return code를 보낸 횟수
Bytes read/written해당 share와 server 사이의 wire byte
Reset`echo 0 > /proc/fs/cifs/Stats`

Application I/O와 wire I/O는 client cache 때문에 다를 수 있습니다.

Kerberos, DFS와 cifs.upcall 구성

821-844

Kerberos extended security는 동작하지만 `cifs.upcall` helper program version 1.2 이상이 설치돼 있고 `/etc/request-key.conf`에 구성돼 있어야 합니다. `cifs.upcall`은 Samba project(`https://www.samba.org`)에서 제공합니다. NTLM, NTLMv2, LANMAN 지원에는 이 helper가 필요하지 않습니다. Kerberos 대신 helper가 필요 없는 NTLMv2 security만으로 충분한 use case도 있습니다.

DFS는 MS-DFS namespace 안의 share로 transparent redirection을 허용합니다. IP address가 아니라 hostname으로 시작하는 UNC 이름의 target share를 지원하려면 `cifs.upcall` 같은 user space helper가 hostname을 IP address로 변환해야 하며, helper를 `/etc/request-key.conf`에도 구성해야 합니다. Samba, Windows server와 여러 NAS appliance는 network 구성을 단순화하고 reliability를 높이는 global namespace 구성 방법으로 DFS를 지원합니다.

CIFS Kerberos와 DFS를 사용하려면 Linux `keyutils` package를 설치하고 `/etc/request-key.conf`에 다음과 같은 줄을 추가합니다.

  create cifs.spnego * * /usr/local/sbin/cifs.upcall %k
  create dns_resolver * * /usr/local/sbin/cifs.upcall %k
Authentication과 helper 필요성
기능cifs.upcall추가 구성
KerberosVersion 1.2+`/etc/request-key.conf`와 keyutils
NTLM / NTLMv2 / LANMAN필요 없음해당 security mode
DFS hostname targetDNS resolver helper 필요`dns_resolver` request-key rule

Mechanism별 cifs.upcall dependency를 구분합니다.

DFS hostname resolution
UNC hostname targetKernel key request/etc/request-key.confcifs.upcallResolve hostname to IPConnect DFS target share

Kernel key request가 user-space helper를 거쳐 target IP를 얻습니다.

CIFS kernel module parameter

845-864

CIFS module parameter는 module load 때 지정하거나 runtime에 다음 interface를 사용해 수정할 수 있습니다.

	/sys/module/cifs/parameters/<param>

Runtime에 값을 쓰는 예는 다음과 같습니다.

    echo "value" > /sys/module/cifs/parameters/<param>

사용 가능한 module parameter와 값의 자세한 설명은 다음 명령으로 확인합니다.

    modinfo cifs (or modinfo smb3)

`enable_oplocks`는 oplock을 활성화하거나 비활성화합니다. Oplock은 기본적으로 활성화돼 있습니다. `[Y/y/1]`로 활성화하고 `[N/n/0]` 중 하나로 비활성화합니다.

Module parameter lifecycle
Module load parametercifs.ko parameter state
`/sys/module/cifs/parameters/<param>`Runtime read/writecifs.ko parameter state

Load-time argument와 sysfs runtime write가 같은 parameter state를 제어합니다.

enable_oplocks parameter
ParameterEnabled valuesDisabled valuesDefault
`enable_oplocks``Y`, `y`, `1``N`, `n`, `0`Enabled

Oplock 기본값과 accepted boolean 값입니다.