Define GNU_SOURCE, required if libreplace doesn't provide comparison_fn_t,
[ira/wip.git] / docs-xml / manpages-3 / mount.cifs.8.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="mount.cifs.8">
4
5 <refmeta>
6         <refentrytitle>mount.cifs</refentrytitle>
7         <manvolnum>8</manvolnum>
8         <refmiscinfo class="source">Samba</refmiscinfo>
9         <refmiscinfo class="manual">System Administration tools</refmiscinfo>
10         <refmiscinfo class="version">3.2</refmiscinfo>
11 </refmeta>
12
13
14 <refnamediv>
15         <refname>mount.cifs</refname>
16         <refpurpose>mount using the Common Internet File System (CIFS)</refpurpose>
17 </refnamediv>
18
19 <refsynopsisdiv>
20         <cmdsynopsis>
21
22                 <command>mount.cifs</command>
23                 <arg choice="req">service</arg> 
24                 <arg choice="req">mount-point</arg>     
25                 <arg choice="opt">-o options</arg>      
26         </cmdsynopsis>
27 </refsynopsisdiv>
28
29 <refsect1>
30         <title>DESCRIPTION</title>
31
32         <para>This tool is part of the <citerefentry><refentrytitle>samba</refentrytitle>
33         <manvolnum>7</manvolnum></citerefentry> suite.</para>
34
35         <para>mount.cifs mounts a Linux CIFS filesystem. It
36 is usually invoked indirectly by
37 the <citerefentry><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> command when using the 
38 "-t cifs" option. This command only works in Linux, and the kernel must
39 support the cifs filesystem. The CIFS protocol is the successor to the 
40 SMB protocol and is supported by most Windows servers and many other
41 commercial servers and Network Attached Storage appliances as well as 
42 by the popular Open Source server Samba.
43         </para>
44
45         <para>
46         The mount.cifs utility attaches the UNC name (exported network resource) to
47         the local directory <emphasis>mount-point</emphasis>. It is possible to set the mode for mount.cifs to 
48 setuid root to allow non-root users to mount shares to directories for which they
49 have write permission.
50         </para>
51
52         <para>
53                 Options to <emphasis>mount.cifs</emphasis> are specified as a comma-separated
54 list of key=value pairs. It is possible to send options other
55 than those listed here, assuming that the cifs filesystem kernel module (cifs.ko) supports them.   
56 Unrecognized cifs mount options passed to the cifs vfs kernel code will be logged to the
57 kernel log.
58
59         </para>
60
61         <para><emphasis>mount.cifs</emphasis> causes the cifs vfs to launch a thread named cifsd. After mounting it keeps running until
62                 the mounted resource is unmounted (usually via the umount utility).
63         </para>
64
65 </refsect1>
66
67 <refsect1>
68         <title>OPTIONS</title>
69         <variablelist>
70                 <varlistentry><term>user=<replaceable>arg</replaceable></term>
71
72                 <listitem><para>specifies the username to connect as. If
73                                 this is not given, then the environment variable <emphasis>USER</emphasis> is used. This option can also take the
74 form "user%password" or "workgroup/user" or
75 "workgroup/user%password" to allow the password and workgroup
76 to be specified as part of the username.
77                 </para>
78
79 <note>
80         <para>
81         The cifs vfs accepts the parameter <parameter>user=</parameter>, or for users familiar with smbfs it accepts the longer form of the parameter <parameter>username=</parameter>.  Similarly the longer smbfs style parameter names may be accepted as synonyms for the shorter cifs parameters <parameter>pass=</parameter>,<parameter>dom=</parameter> and <parameter>cred=</parameter>.
82         </para>
83 </note>
84
85                 </listitem>
86         </varlistentry>
87
88         <varlistentry><term>password=<replaceable>arg</replaceable></term>
89
90                 <listitem><para>specifies the CIFS password. If this
91 option is not given then the environment variable
92 <emphasis>PASSWD</emphasis> is used. If the password is not specified
93 directly or indirectly via an argument to mount, <emphasis>mount.cifs</emphasis> will prompt
94 for a password, unless the guest option is specified.
95 </para>
96
97 <para>Note that a password which contains the delimiter
98 character (i.e. a comma ',') will fail to be parsed correctly
99 on the command line.  However, the same password defined
100 in the PASSWD environment variable or via a credentials file (see
101 below) or entered at the password prompt will be read correctly.
102 </para>
103         </listitem></varlistentry>
104
105         <varlistentry><term>credentials=<replaceable>filename</replaceable></term>
106
107                 <listitem><para>
108                                 specifies a file that contains a username
109                                 and/or password and optionally the name of the
110                                 workgroup. The format of the file is:
111                         </para>
112
113 <programlisting>
114                 username=<replaceable>value</replaceable>
115                 password=<replaceable>value</replaceable>
116                 workgroup=<replaceable>value</replaceable>
117 </programlisting>
118
119                 <para>
120 This is preferred over having passwords in plaintext in a
121 shared file, such as <filename>/etc/fstab</filename>. Be sure to protect any
122 credentials file properly.
123                 </para>
124         </listitem></varlistentry>
125
126         <varlistentry>
127                 <term>uid=<replaceable>arg</replaceable></term>
128
129                 <listitem><para>sets the uid that will own all files on
130         the mounted filesystem.
131         It may be specified as either a username or a numeric uid.
132         For mounts to servers which do support the CIFS Unix extensions, 
133         such as a properly configured Samba server, the server provides
134                 the uid, gid and mode so this parameter should not be
135                 specified unless the server and client uid and gid
136                 numbering differ.  If the server and client are in the
137                 same domain (e.g. running winbind or nss_ldap) and
138                 the server supports the Unix Extensions then the uid
139                 and gid can be retrieved from the server (and uid
140                 and gid would not have to be specifed on the mount. 
141                 For servers which do not support the CIFS Unix
142                 extensions, the default uid (and gid) returned on lookup 
143                 of existing files will be the uid (gid) of the person
144                 who executed the mount (root, except when mount.cifs
145                 is configured setuid for user mounts) unless the "uid="
146                 (gid) mount option is specified.  For the uid (gid) of newly
147                 created files and directories, ie files created since
148                 the last mount of the server share, the expected uid
149                 (gid) is cached as long as the inode remains in
150                 memory on the client.   Also note that permission
151                 checks (authorization checks) on accesses to a file occur
152                 at the server, but there are cases in which an administrator
153                 may want to restrict at the client as well.  For those
154                 servers which do not report a uid/gid owner
155                 (such as Windows), permissions can also be checked at the
156                 client, and a crude form of client side permission checking
157                 can be enabled by specifying file_mode and dir_mode on
158                 the client.  Note that the mount.cifs helper must be
159                 at version 1.10 or higher to support specifying the uid
160                 (or gid) in non-numeric form.
161         </para></listitem>
162         </varlistentry>
163
164         <varlistentry>
165                 <term>gid=<replaceable>arg</replaceable></term>
166
167                 <listitem><para>sets the gid that will own all files on
168 the mounted filesystem.  It may be specified as either a groupname or a numeric 
169 gid. For other considerations see the description of uid above. 
170                 </para></listitem>
171         </varlistentry>
172
173         <varlistentry>
174                 <term>port=<replaceable>arg</replaceable></term>
175
176                 <listitem><para>sets the port number on the server to attempt to contact to negotiate
177 CIFS support.  If the CIFS server is not listening on this port or
178 if it is not specified, the default ports will be tried i.e. 
179 port 445 is tried and if no response then port 139 is tried.
180                 </para></listitem>
181         </varlistentry>
182
183         <varlistentry>
184                 <term>servern=<replaceable>arg</replaceable></term>
185
186                 <listitem><para>
187                 Specify the server netbios name (RFC1001 name) to use
188                 when attempting to setup a session to the server. Although
189                 rarely needed for mounting to newer servers, this option
190                 is needed for mounting to some older servers (such
191                 as OS/2 or Windows 98 and Windows ME) since when connecting
192                 over port 139 they, unlike most newer servers, do not
193                 support a default server name.  A server name can be up
194                 to 15 characters long and is usually uppercased.
195                 </para></listitem>
196         </varlistentry>
197
198         <varlistentry>
199                 <term>netbiosname=<replaceable>arg</replaceable></term>
200
201                 <listitem><para>When mounting to servers via port 139, specifies the RFC1001
202                 source name to use to represent the client netbios machine
203                 name when doing the RFC1001 netbios session initialize.
204                 </para></listitem>
205         </varlistentry>
206
207         <varlistentry>
208                 <term>file_mode=<replaceable>arg</replaceable></term>
209
210                 <listitem><para>If the server does not support the CIFS Unix extensions this
211                                 overrides the default file mode.</para></listitem>
212         </varlistentry>
213
214         <varlistentry>
215                 <term>dir_mode=<replaceable>arg</replaceable></term>
216
217                 <listitem><para>If the server does not support the CIFS Unix extensions this
218                                 overrides the default mode for directories. </para></listitem>
219         </varlistentry>
220
221         <varlistentry>
222                 <term>ip=<replaceable>arg</replaceable></term>
223
224                 <listitem><para>sets the destination IP address.  This option is set automatically if the server name portion of the requested UNC name can be resolved so rarely needs to be specified by the user.</para></listitem>
225         </varlistentry>
226
227         <varlistentry>
228                 <term>domain=<replaceable>arg</replaceable></term>
229
230                 <listitem><para>sets the domain (workgroup) of the user </para></listitem>
231         </varlistentry>
232
233         <varlistentry>
234                 <term>guest</term>
235
236                 <listitem><para>don't prompt for a password </para></listitem>
237
238         </varlistentry>
239
240         <varlistentry>
241                 <term>iocharset</term>
242
243                 <listitem><para>Charset used to convert local path names to and from
244                 Unicode. Unicode is used by default for network path
245                 names if the server supports it. If iocharset is
246                 not specified then the nls_default specified
247                 during the local client kernel build will be used.
248                 If server does not support Unicode, this parameter is
249                 unused. </para></listitem>
250
251         </varlistentry>
252
253         <varlistentry>
254                 <term>ro</term>
255
256                 <listitem><para>mount read-only</para></listitem>
257
258         </varlistentry>
259
260         <varlistentry>
261                 <term>rw</term>
262                 <listitem><para>mount read-write</para></listitem>
263         </varlistentry>
264
265         <varlistentry>
266                 <term>setuids</term>
267                 <listitem><para>If the CIFS Unix extensions are negotiated with the server
268                 the client will attempt to set the effective uid and gid of
269                 the local process on newly created files, directories, and
270                 devices (create, mkdir, mknod). If the CIFS Unix Extensions
271                 are not negotiated, for newly created files and directories
272                 instead of using the default uid and gid specified on the
273                 the mount, cache the new file's uid and gid locally which means
274                 that the uid for the file can change when the inode is
275                 reloaded (or the user remounts the share).</para></listitem>
276         </varlistentry>
277
278         <varlistentry>
279                 <term>nosetuids</term>
280                 <listitem><para>The client will not attempt to set the uid and gid on
281                 on newly created files, directories, and devices (create,
282                 mkdir, mknod) which will result in the server setting the
283                 uid and gid to the default (usually the server uid of the
284                 user who mounted the share).  Letting the server (rather than
285                 the client) set the uid and gid is the default.If the CIFS
286                 Unix Extensions are not negotiated then the uid and gid for
287                 new files will appear to be the uid (gid) of the mounter or the
288                 uid (gid) parameter specified on the mount.</para></listitem>
289         </varlistentry>
290
291         <varlistentry>
292                 <term>perm</term>
293                 <listitem><para>Client does permission checks (vfs_permission check of uid
294                 and gid of the file against the mode and desired operation),
295                 Note that this is in addition to the normal ACL check on the
296                 target machine done by the server software.
297                 Client permission checking is enabled by default.</para></listitem>
298         </varlistentry>
299
300         <varlistentry>
301                 <term>noperm</term>
302                 <listitem><para>Client does not do permission checks.  This can expose
303                 files on this mount to access by other users on the local
304                 client system. It is typically only needed when the server
305                 supports the CIFS Unix Extensions but the UIDs/GIDs on the
306                 client and server system do not match closely enough to allow
307                 access by the user doing the mount.
308                 Note that this does not affect the normal ACL check on the
309                 target machine done by the server software (of the server
310                 ACL against the user name provided at mount time).</para></listitem>
311         </varlistentry>
312
313         <varlistentry>
314                 <term>directio</term>
315                 <listitem><para>Do not do inode data caching on files opened on this mount.
316                 This precludes mmaping files on this mount. In some cases
317                 with fast networks and little or no caching benefits on the
318                 client (e.g. when the application is doing large sequential
319                 reads bigger than page size without rereading the same data)
320                 this can provide better performance than the default
321                 behavior which caches reads (readahead) and writes
322                 (writebehind) through the local Linux client pagecache
323                 if oplock (caching token) is granted and held. Note that
324                 direct allows write operations larger than page size
325                 to be sent to the server. On some kernels this requires the cifs.ko module
326                 to be built with the CIFS_EXPERIMENTAL configure option.</para></listitem>
327         </varlistentry>
328
329         <varlistentry>
330                 <term>mapchars</term>
331                 <listitem><para>Translate six of the seven reserved characters (not backslash, but including the colon, question mark, pipe, asterik, greater than and less than characters)
332                 to the remap range (above 0xF000), which also
333                 allows the CIFS client to recognize files created with
334                 such characters by Windows's POSIX emulation. This can
335                 also be useful when mounting to most versions of Samba
336                 (which also forbids creating and opening files
337                 whose names contain any of these seven characters).
338                 This has no effect if the server does not support
339                 Unicode on the wire.</para></listitem>
340         </varlistentry>
341
342         <varlistentry>
343                 <term>nomapchars</term>
344                 <listitem><para>Do not translate any of these seven characters (default)</para></listitem>
345         </varlistentry>
346
347         <varlistentry>
348                 <term>intr</term>
349                 <listitem><para>currently unimplemented</para></listitem>
350         </varlistentry>
351
352         <varlistentry>
353                 <term>nointr</term>
354                 <listitem><para>(default) currently unimplemented </para></listitem>
355         </varlistentry>
356
357         <varlistentry>
358                 <term>hard</term>
359                 <listitem><para>The  program  accessing  a file on the cifs mounted file system will hang when the
360               server crashes.</para></listitem>
361         </varlistentry>
362
363         <varlistentry>
364                 <term>soft</term>
365                 <listitem><para>(default) The  program  accessing  a file on the cifs mounted file system will not hang when the server crashes and will return errors to the user application.</para></listitem>
366         </varlistentry>
367
368         <varlistentry>
369                 <term>noacl</term>
370                 <listitem><para>Do not allow POSIX ACL operations even if server would support them.</para><para>
371                 The CIFS client can get and set POSIX ACLs (getfacl, setfacl) to Samba servers
372                 version 3.10 and later.  Setting POSIX ACLs requires enabling both XATTR and
373                 then POSIX support in the CIFS configuration options when building the cifs
374                 module.  POSIX ACL support can be disabled on a per mount basic by specifying
375                 "noacl" on mount.</para>
376                 </listitem>
377         </varlistentry>
378
379         <varlistentry>
380                 <term>nocase</term>
381                 <listitem>
382                 <para>Request case insensitive path name matching (case
383                 sensitive is the default if the server suports it).
384                 </para>
385                 </listitem>
386         </varlistentry>
387
388         <varlistentry>
389                 <term>sec=</term>
390                 <listitem>
391                 <para>Security mode.  Allowed values are:</para>
392                         <itemizedlist>
393                         <listitem><para>none    attempt to connection as a null user (no name) </para></listitem>
394                         <listitem><para>krb5    Use Kerberos version 5 authentication</para></listitem>
395                         <listitem><para>krb5i   Use Kerberos authentication and packet signing</para></listitem>
396                         <listitem><para>ntlm    Use NTLM password hashing (default)</para></listitem>
397                         <listitem><para>ntlmi   Use NTLM password hashing with signing (if
398                                 /proc/fs/cifs/PacketSigningEnabled on or if
399                                 server requires signing also can be the default)</para></listitem>
400                         <listitem><para>ntlmv2  Use NTLMv2 password hashing</para></listitem>
401                         <listitem><para>ntlmv2i Use NTLMv2 password hashing with packet signing</para></listitem>
402                         </itemizedlist>
403
404                         <para>[NB This [sec parameter] is under development and expected to be available in cifs kernel module 1.40 and later]
405                 </para>
406                 </listitem>
407         </varlistentry>
408
409         <varlistentry>
410                 <term>nobrl</term>
411                 <listitem>
412                 <para>Do not send byte range lock requests to the server.
413                 This is necessary for certain applications that break
414                 with cifs style mandatory byte range locks (and most
415                 cifs servers do not yet support requesting advisory
416                 byte range locks).
417                 </para>
418                 </listitem>
419         </varlistentry>
420
421         <varlistentry>
422                 <term>sfu</term>
423                 <listitem>
424                 <para>
425                 When the CIFS Unix Extensions are not negotiated, attempt to
426                 create device files and fifos in a format compatible with
427                 Services for Unix (SFU).  In addition retrieve bits 10-12
428                 of the mode via the SETFILEBITS extended attribute (as
429                 SFU does).  In the future the bottom 9 bits of the mode
430                 mode also will be emulated using queries of the security
431                 descriptor (ACL). [NB: requires version 1.39 or later
432                 of the CIFS VFS.  To recognize symlinks and be able
433                 to create symlinks in an SFU interoperable form
434                 requires version 1.40 or later of the CIFS VFS kernel module.
435                 </para>
436                 </listitem>
437         </varlistentry>
438
439         <varlistentry>
440                 <term>serverino</term>
441                 <listitem><para>Use inode numbers (unique persistent file identifiers)
442                 returned by the server instead of automatically generating
443                 temporary inode numbers on the client.  Although server inode numbers
444                 make it easier to spot hardlinked files (as they will have
445                 the same inode numbers) and inode numbers may be persistent (which is
446                 userful for some sofware),
447                 the server does not guarantee that the inode numbers
448                 are unique if multiple server side mounts are exported under a
449                 single share (since inode numbers on the servers might not
450                 be unique if multiple filesystems are mounted under the same
451                 shared higher level directory).  Note that not all 
452                 servers support returning server inode numbers, although
453                 those that support the CIFS Unix Extensions, and Windows 2000 and
454                 later servers typically do support this (although not necessarily
455                 on every local server filesystem). Parameter has no effect if
456                 the server lacks support for returning inode numbers or equivalent.
457                 </para></listitem>
458         </varlistentry>
459
460         <varlistentry>
461                 <term>noserverino</term>
462                 <listitem><para>client generates inode numbers (rather than using the actual one
463                 from the server) by default.
464                 </para></listitem>
465         </varlistentry>
466
467         <varlistentry>
468                 <term>nouser_xattr</term>
469                 <listitem><para>(default) Do not allow getfattr/setfattr to get/set xattrs, even if server would support it otherwise. </para></listitem>
470         </varlistentry>
471
472         <varlistentry>
473                 <term>rsize=<replaceable>arg</replaceable></term>
474                 <listitem><para>default network read size (usually 16K). The client currently
475                 can not use rsize larger than CIFSMaxBufSize. CIFSMaxBufSize
476                 defaults to 16K and may be changed (from 8K to the maximum
477                 kmalloc size allowed by your kernel) at module install time
478                 for cifs.ko. Setting CIFSMaxBufSize to a very large value
479                 will cause cifs to use more memory and may reduce performance
480                 in some cases.  To use rsize greater than 127K (the original
481                 cifs protocol maximum) also requires that the server support
482                 a new Unix Capability flag (for very large read) which some
483                 newer servers (e.g. Samba 3.0.26 or later) do. rsize can be
484                 set from a minimum of 2048 to a maximum of 130048 (127K or
485                 CIFSMaxBufSize, whichever is smaller)
486
487                 </para></listitem>
488         </varlistentry>
489
490         <varlistentry>
491                 <term>wsize=<replaceable>arg</replaceable></term>
492
493                 <listitem><para>default network write size (default 57344)
494                 maximum wsize currently allowed by CIFS is 57344 (fourteen
495                 4096 byte pages)</para></listitem>
496         </varlistentry>
497          <varlistentry>
498                 <term>--verbose</term>
499                 <listitem><para>Print additional debugging information for the mount. Note that this parameter must be specified before the -o. For example:</para><para>mount -t cifs //server/share /mnt --verbose -o user=username</para></listitem>
500         </varlistentry>
501
502
503         </variablelist>
504 </refsect1>
505
506 <refsect1>
507         <title>SERVICE FORMATTING AND DELIMITERS</title>
508
509         <para>
510                 It's generally preferred to use forward slashes (/) as a delimiter in service names. They are considered to be the "universal delimiter" since they are generally not allowed to be embedded within path components on Windows machines and the client can convert them to blackslashes (\) unconditionally. Conversely, backslash characters are allowed by POSIX to be part of a path component, and can't be automatically converted in the same way.
511         </para>
512         <para>
513                 mount.cifs will attempt to convert backslashes to forward slashes where it's able to do so, but it cannot do so in any path component following the sharename.
514         </para>
515 </refsect1>
516
517 <refsect1>
518         <title>ENVIRONMENT VARIABLES</title>
519
520         <para>
521                 The variable <emphasis>USER</emphasis> may contain the username of the
522 person to be used to authenticate to the server.
523 The variable can be used to set both username and
524 password by using the format username%password.
525         </para>
526         
527         <para>
528                 The variable <emphasis>PASSWD</emphasis> may contain the password of the
529 person using the client.
530         </para>
531
532         <para>
533                 The variable <emphasis>PASSWD_FILE</emphasis> may contain the pathname
534 of a file to read the password from. A single line of input is
535 read and used as the password.
536         </para>
537
538 </refsect1>
539
540 <refsect1>
541         <title>NOTES</title>
542         
543         <para>This command may be used only by root, unless installed setuid, in which case the noeexec and nosuid mount flags are enabled.</para>
544 </refsect1>
545
546 <refsect1>
547         <title>CONFIGURATION</title>
548                 <para>
549 The primary mechanism for making configuration changes and for reading 
550 debug information for the cifs vfs is via the Linux /proc filesystem.
551 In the directory <filename>/proc/fs/cifs</filename> are various 
552 configuration files and pseudo files which can display debug information.  
553 There are additional startup options such as maximum buffer size and number
554 of buffers which only may be set when the kernel cifs vfs (cifs.ko module) is 
555 loaded.  These can be seen by running the modinfo utility against the file
556 cifs.ko which will list the options that may be passed to cifs during module
557 installation (device driver load).
558 For more information see the kernel file <filename>fs/cifs/README</filename>.
559 </para>
560 </refsect1>
561
562 <refsect1>
563         <title>BUGS</title>
564
565         <para>Mounting using the CIFS URL specification is currently not supported.
566         </para>
567
568         <para>The credentials file does not handle usernames or passwords with
569                 leading space.</para>
570
571         <para>
572 Note that the typical response to a bug report is a suggestion
573 to try the latest version first. So please try doing that first,
574 and always include which versions you use of relevant software
575 when reporting bugs (minimum: mount.cifs (try mount.cifs -V), kernel (see /proc/version) and
576 server type you are trying to contact.
577 </para>
578 </refsect1>
579
580
581
582 <refsect1>
583         <title>VERSION</title>
584
585         <para>This man page is correct for version 1.52 of 
586         the cifs vfs filesystem (roughly Linux kernel 2.6.24).</para>
587 </refsect1>
588
589 <refsect1>
590         <title>SEE ALSO</title>
591         <para>
592         Documentation/filesystems/cifs.txt and fs/cifs/README in the linux kernel
593         source tree may contain additional options and information.
594 </para>
595         <para><citerefentry><refentrytitle>umount.cifs</refentrytitle>
596         <manvolnum>8</manvolnum></citerefentry></para>
597
598 </refsect1>
599
600 <refsect1>
601         <title>AUTHOR</title>
602         
603         <para>Steve French</para>
604
605         <para>The syntax and manpage were loosely based on that of smbmount. It 
606                 was converted to Docbook/XML by Jelmer Vernooij.</para>
607
608         <para>The maintainer of the Linux cifs vfs and the userspace
609                 tool <emphasis>mount.cifs</emphasis> is <ulink url="mailto:sfrench@samba.org">Steve French</ulink>.
610                 The <ulink url="mailto:linux-cifs-client@lists.samba.org">Linux CIFS Mailing list</ulink> 
611                 is the preferred place to ask questions regarding these programs. 
612         </para>
613
614 </refsect1>
615
616 </refentry>