README 18.4 KB
Newer Older
1 2 3 4 5
The CIFS VFS support for Linux supports many advanced network filesystem 
features such as heirarchical dfs like namespace, hardlinks, locking and more.  
It was designed to comply with the SNIA CIFS Technical Reference (which 
supersedes the 1992 X/Open SMB Standard) as well as to perform best practice 
practical interoperability with Windows 2000, Windows XP, Samba and equivalent 
6 7
servers.  

8 9
For questions or bug reports please contact:
    sfrench@samba.org (sfrench@us.ibm.com) 
10 11 12

Build instructions:
==================
13
For Linux 2.4:
14
1) Get the kernel source (e.g.from http://www.kernel.org)
15 16 17 18 19 20
and download the cifs vfs source (see the project page
at http://us1.samba.org/samba/Linux_CIFS_client.html)
and change directory into the top of the kernel directory
then patch the kernel (e.g. "patch -p1 < cifs_24.patch") 
to add the cifs vfs to your kernel configure options if
it has not already been added (e.g. current SuSE and UL
21
users do not need to apply the cifs_24.patch since the cifs vfs is
22 23 24
already in the kernel configure menu) and then
mkdir linux/fs/cifs and then copy the current cifs vfs files from
the cifs download to your kernel build directory e.g.
25

26
	cp <cifs_download_dir>/fs/cifs/* to <kernel_download_dir>/fs/cifs
27
	
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
2) make menuconfig (or make xconfig)
3) select cifs from within the network filesystem choices
4) save and exit
5) make dep
6) make modules (or "make" if CIFS VFS not to be built as a module)

For Linux 2.5:
1) Download the kernel (e.g. from http://www.kernel.org or from bitkeeper
at bk://linux.bkbits.net/linux-2.5) 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

43 44 45

Installation instructions:
=========================
46 47
If you have built the CIFS vfs as module (successfully) simply
type "make modules_install" (or if you prefer, manually copy the file to
48 49 50 51 52 53
the modules directory e.g. /lib/modules/2.4.10-4GB/kernel/fs/cifs/cifs.o).

If you have built the CIFS vfs into the kernel itself, follow the instructions
for your distribution on how to install a new kernel (usually you
would simply type "make install").

54 55
If you do not have the utility mount.cifs (in the Samba 3.0 source tree and on 
the CIFS VFS web site) copy it to the same directory in which mount.smbfs and 
56 57 58 59 60 61 62
similar files reside (usually /sbin).  Although the helper software is not  
required, mount.cifs is recommended.  Eventually the Samba 3.0 utility program 
"net" may also be helpful since it may someday provide easier mount syntax for
users who are used to Windows e.g.  net use <mount point> <UNC name or cifs URL>  
Note that running the Winbind pam/nss module (logon service) on all of your
Linux clients is useful in mapping Uids and Gids consistently across the
domain to the proper network user.  The mount.cifs mount helper can be
63 64 65
trivially built from Samba 3.0 or later source e.g. by executing:

	gcc samba/source/client/mount.cifs.c -o mount.cifs
66 67 68 69 70 71 72 73 74 75 76 77 78

Note that when the mount.cifs utility is run suid (allowing user mounts), 
in order to reduce risks, the "nosuid" mount flag is passed in on mount to
disallow execution of an suid program mounted on the remote target.
When mount is executed as root, nosuid is not passed in by default,
and execution of suid programs on the remote target would be enabled
by default. This can be changed, as with nfs and other filesystems, 
by simply specifying "nosuid" among the mount options. For user mounts 
though to be able to pass the suid flag to mount requires rebuilding 
mount.cifs with the following flag: 
 
        gcc samba/source/client/mount.cifs.c -DCIFS_ALLOW_USR_SUID -o mount.cifs

79 80 81 82 83 84 85 86 87 88
There is a corresponding manual page for cifs mounting in the Samba 3.0 and
later source tree in docs/manpages/mount.cifs.8 

Samba Considerations 
==================== 
To get the maximum benefit from the CIFS VFS, we recommend using a server that 
supports the SNIA CIFS Unix Extensions standard (e.g.  Samba 2.2.5 or later or 
Samba 3.0) but the CIFS vfs works fine with a wide variety of CIFS servers.  
Note that uid, gid and file permissions will display default values if you do 
not have a server that supports the Unix extensions for CIFS (such as Samba 
89
2.2.5 or later).  To enable the Unix CIFS Extensions in the Samba server, add 
90 91
the line: 

92
	unix extensions = yes
93 94 95 96 97
	
to your smb.conf file on the server.  Note that the following smb.conf settings 
are also useful (on the Samba server) when the majority of clients are Unix or 
Linux: 

98
	case sensitive = yes
99
	delete readonly = yes 
Steve French's avatar
Steve French committed
100 101 102
	ea support = yes

Note that ea support is required for supporting Linux xattrs. 
103
Some administrators also change the "map archive" and the "create mask" 
104 105 106 107 108
parameters from their default values.  Creating special devices (mknod) 
remotely may require specifying a mkdev function to Samba if you are not using 
Samba 3.0.5 or later.  For more information on these see the manual pages
("man smb.conf") on the Samba server system.  Note that the cifs vfs,
unlike the smbfs vfs, does not read the smb.conf on the client system 
109
(the few optional settings are passed in on mount via -o parameters instead).  
110
Note that Samba 2.2.7 or later includes a fix that allows the CIFS VFS to delete
111
open files (required for strict POSIX compliance).  Windows Servers already 
112 113 114 115 116 117 118 119 120 121 122 123 124
supported this feature. Samba server does not allow symlinks that refer to files
outside of the share, so in Samba versions prior to 3.0.5, most symlinks to
files with absolute paths (ie beginning with slash) such as:
	 ln -s /mnt/foo bar
would be forbidden. Samba 3.0.5 server or later includes the ability to create 
such symlinks safely by converting unsafe symlinks (ie symlinks to server 
files that are outside of the share) to a samba specific format on the server
that is ignored by local server applications and non-cifs clients and that will
not be traversed by the Samba server).  This is opaque to the Linux client
application using the cifs vfs. Absolute symlinks will work to Samba 3.0.5 or
later, but only for remote clients using the CIFS Unix extensions, and will
be invisbile to Windows clients and typically will not affect local
applications running on the same server as Samba.  
125 126 127

Use instructions:
================
128 129 130 131
Once the CIFS VFS support is built into the kernel or installed as a module 
(cifs.o), you can use mount syntax like the following to access Samba or Windows 
servers: 

132
  mount -t cifs //9.53.216.11/e$ /mnt -o user=myname,pass=mypassword
133 134 135 136 137

Before -o the option -v may be specified to make the mount.cifs
mount helper display the mount steps more verbosely.  
After -o the following commonly used cifs vfs specific options
are supported:
138

139 140 141
  user=<username>
  pass=<password>
  domain=<domain name>
142
  
Steve French's avatar
Steve French committed
143 144 145 146 147 148 149
Other cifs mount options are described below.  Use of TCP names (in addition to
ip addresses) is available if the mount helper (mount.cifs) is installed. If
you do not trust the server to which are mounted, or if you do not have
cifs signing enabled (and the physical network is insecure), consider use
of the standard mount options "noexec" and "nosuid" to reduce the risk of 
running an altered binary on your local system (downloaded from a hostile server
or altered by a hostile router).
150

151 152 153 154 155 156 157 158 159
When using the mount helper mount.cifs, passwords may be specified via alternate
mechanisms, instead of specifying it after -o using the normal "pass=" syntax
on the command line:
1) By including it in a credential file. Specify credentials=filename as one
of the mount options. Credential files contain two lines
        username=someuser
        password=your_password
2) By specifying the password in the PASSWD environment variable (similarly
the user name can be taken from the USER environment variable).
160 161
3) By specifying the password in a file by name via PASSWD_FILE
4) By specifying the password in a file by file descriptor via PASSWD_FD
162 163 164

If no password is provided, mount.cifs will prompt for password entry

165 166
Restrictions
============
167
Servers must support the NTLM SMB dialect (which is the most recent, supported 
Steve French's avatar
Steve French committed
168 169
by Samba and Windows NT version 4, 2000 and XP and many other SMB/CIFS servers) 
Servers must support either "pure-TCP" (port 445 TCP/IP CIFS connections) or RFC 
170 171
1001/1002 support for "Netbios-Over-TCP/IP." Neither of these is likely to be a 
problem as most servers support this.  IPv6 support is planned for the future.  
172

173 174 175 176 177 178 179 180 181 182 183 184 185
CIFS VFS Mount Options
======================
A partial list of the supported mount options follows:
  user		The user name to use when trying to establish
		the CIFS session.
  password	The user password.  If the mount helper is
		installed, the user will be prompted for password
		if it is not supplied.
  ip		The ip address of the target server
  unc		The target server Universal Network Name (export) to 
		mount.	
  domain	Set the SMB/CIFS workgroup name prepended to the
		username during CIFS session establishment
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
  uid		If CIFS Unix extensions are not supported by the server
		this overrides the default uid for inodes. For mounts to
		servers which do support the CIFS Unix extensions, such
		as a properly configured Samba server, the server provides
		the uid, gid and mode.  For servers which do not support
		the Unix extensions, the default uid (and gid) returned on
		lookup of existing files is the uid (gid) of the person
		who executed the mount (root, except when mount.cifs
		is configured setuid for user mounts) unless the "uid=" 
		(gid) mount option is specified.  For the uid (gid) of newly
		created files and directories, ie files created since 
		the last mount of the server share, the expected uid 
		(gid) is cached as as long as the inode remains in 
		memory on the client.   Also note that permission
		checks (authorization checks) on accesses to a file occur
		at the server, but there are cases in which an administrator
		may want to restrict at the client as well.  For those
		servers which do not report a uid/gid owner
		(such as Windows), permissions can also be checked at the
		client, and a crude form of client side permission checking 
		can be enabled by specifying file_mode and dir_mode on 
		the client
208 209 210 211 212 213 214 215
  gid		If CIFS Unix extensions are not supported by the server
		this overrides the default gid for inodes.
  file_mode     If CIFS Unix extensions are not supported by the server
		this overrides the default mode for file inodes.
  dir_mode      If CIFS Unix extensions are not supported by the server 
		this overrides the default mode for directory inodes.
  port		attempt to contact the server on this tcp port, before
		trying the usual ports (port 445, then 139).
216 217 218 219 220 221 222
  iocharset     Codepage used to convert local path names to and from
		Unicode. Unicode is used by default for network path
		names if the server supports it.  If iocharset is
		not specified then the nls_default specified
		during the local client kernel build will be used.
		If server does not support Unicode, this parameter is
		unused.
223 224 225 226 227 228 229
  rsize		default read size
  wsize		default write size
  rw		mount the network share read-write (note that the
		server may still consider the share read-only)
  ro		mount network share read-only
  version	used to distinguish different versions of the
		mount helper utility (not typically needed)
230 231 232 233 234 235 236 237 238 239
  sep		if first mount option (after the -o), overrides
		the comma as the separator between the mount
		parms. e.g.
			-o user=myname,password=mypassword,domain=mydom
		could be passed instead with period as the separator by
			-o sep=.user=myname.password=mypassword.domain=mydom
		this might be useful when comma is contained within username
		or password or domain. This option is less important
		when the cifs mount helper cifs.mount (version 1.1 or later)
		is used.
240 241 242 243 244 245 246 247 248
  nosuid        Do not allow remote executables with the suid bit 
		program to be executed.  This is only meaningful for mounts
		to servers such as Samba which support the CIFS Unix Extensions.
		If you do not trust the servers in your network (your mount
		targets) it is recommended that you specify this option for
		greater security.
  suid          Allow remote files on this mountpoint with suid enabled to 
		be executed (default for mounts when executed as root,
		nosuid is default for user mounts).
Steve French's avatar
Steve French committed
249 250 251 252 253 254 255 256 257
  credentials   Although ignored by the cifs kernel component, it is used by 
		the mount helper, mount.cifs. When mount.cifs is installed it
		opens and reads the credential file specified in order  
		to obtain the userid and password arguments which are passed to
		the cifs vfs.
  guest         Although ignored by the kernel component, the mount.cifs
		mount helper will not prompt the user for a password
		if guest is specified on the mount options.  If no
		password is specified a null password will be used.
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
  perm          Client does permission checks (vfs_permission check of uid
		and gid of the file against the mode and desired operation),
		Note that this is in addition to the normal ACL check on the
		target machine done by the server software. 
		Client permission checking is enabled by default.
  noperm        Client does not do permission checks.  This can expose
		files on this mount to access by other users on the local
		client system. It is typically only needed when the server
		supports the CIFS Unix Extensions but the UIDs/GIDs on the
		client and server system do not match closely enough to allow
		access by the user doing the mount.
		Note that this does not affect the normal ACL check on the
		target machine done by the server software (of the server
		ACL against the user name provided at mount time).
  setuids       If the CIFS Unix extensions are negotiated with the server
		the client will attempt to set the effective uid and gid of
		the local process on newly created files, directories, and
		devices (create, mkdir, mknod).
  nosetuids     The client will not attempt to set the uid and gid on
		on newly created files, directories, and devices (create, 
		mkdir, mknod) which will result in the server setting the
		uid and gid to the default (usually the server uid of the
		usern who mounted the share).  Letting the server (rather than
		the client) set the uid and gid is the default. This
		parameter has no effect if the CIFS Unix Extensions are not
		negotiated.
		
285 286 287 288 289 290 291 292 293 294 295
The mount.cifs mount helper also accepts a few mount options before -o
including:

	-S      take password from stdin (equivalent to setting the environment
		variable "PASSWD_FD=0"
	-V      print mount.cifs version
	-?      display simple usage information

With recent 2.6 kernel versions of modutils, the version of the cifs kernel
module can be displayed via modinfo.

296 297
Misc /proc/fs/cifs Flags and Debug Info
=======================================
298
Informational pseudo-files:
299
DebugData		Displays information about active CIFS sessions
Steve French's avatar
Steve French committed
300 301 302 303
			and shares.
Stats			Lists summary resource usage information as well as per
			share statistics, if CONFIG_CIFS_STATS in enabled
			in the kernel configuration.
304 305

Configuration pseudo-files:
306
MultiuserMount		If set to one, more than one CIFS session to 
307 308 309 310
			the same server ip address can be established
			if more than one uid accesses the same mount
			point and if the uids user/password mapping
			information is available. (default is 0)
311
PacketSigningEnabled	If set to one, cifs packet signing is enabled
312 313 314 315
			and will be used if the server requires 
			it.  If set to two, cifs packet signing is
			required even if the server considers packet
			signing optional. (default 1)
316
cifsFYI			If set to one, additional debug information is
317
			logged to the system error log. (default 0)
318
ExtendedSecurity	If set to one, SPNEGO session establishment
319 320
			is allowed which enables more advanced 
			secure CIFS session establishment (default 0)
321
NTLMV2Enabled		If set to one, more secure password hashes
322 323
			are used when the server supports them and
			when kerberos is not negotiated (default 0)
324
traceSMB		If set to one, debug information is logged to the
325 326
			system error log with the start of smb requests
			and responses (default 0)
327
LookupCacheEnable	If set to one, inode information is kept cached
328 329
			for one second improving performance of lookups
			(default 1)
330
OplockEnabled		If set to one, safe distributed caching enabled.
331
			(default 1)
332 333 334 335 336 337 338 339 340
LinuxExtensionsEnabled	If set to one then the client will attempt to
			use the CIFS "UNIX" extensions which are optional
			protocol enhancements that allow CIFS servers
			to return accurate UID/GID information as well
			as support symbolic links. If you use servers
			such as Samba that support the CIFS Unix
			extensions but do not want to use symbolic link
			support and want to map the uid and gid fields 
			to values supplied at mount (rather than the 
Steve French's avatar
Steve French committed
341
			actual values, then set this to zero. (default 1)
342

343 344 345 346 347
These experimental features and tracing can be enabled by changing flags in 
/proc/fs/cifs (after the cifs module has been installed or built into the 
kernel, e.g.  insmod cifs).  To enable a feature set it to 1 e.g.  to enable 
tracing to the kernel message log type: 

348
	echo 1 > /proc/fs/cifs/cifsFYI
349
	
350
and for more extensive tracing including the start of smb requests and responses
351

352
	echo 1 > /proc/fs/cifs/traceSMB
Steve French's avatar
Steve French committed
353 354 355 356

Three other experimental features are under development and to test 
require enabling an ifdef (e.g. by  adding "#define CIFS_FCNTL" in cifsglob.h)

357
	CONFIG_CIFS_QUOTA
Steve French's avatar
Steve French committed
358

359
	CONFIG_CIFS_XATTR
Steve French's avatar
Steve French committed
360

361 362 363 364 365 366 367 368 369 370 371 372 373
	CONFIG_CIFS_FCNTL  (fcntl needed for support of directory change 
			    notification and perhaps later for file leases)

Per share (per client mount) statistics are available in /proc/fs/cifs/DebugData
if the kernel was configured with cifs statistics enabled.  The statistics
represent the number of successful (ie non-zero return code from the server) 
SMB responses to some of the more common commands (open, delete, mkdir etc.).
Also recorded is the total bytes read and bytes written to the server for
that share.  Note that due to client caching effects this can be less than the
number of bytes read and written by the application running on the client.
The statistics for the number of total SMBs and oplock breaks are different in
that they represent all for that share, not just those for which the server
returned success.
374
	
375
Also note that "cat /proc/fs/cifs/DebugData" will display information about 
376 377 378
the active sessions and the shares that are mounted.  Note: NTLMv2 enablement 
will not work since they its implementation is not quite complete yet.
Do not alter these configuration values unless you are doing specific testing.  
379 380 381 382
Enabling extended security works to Windows 2000 Workstations and XP but not to 
Windows 2000 server or Samba since it does not usually send "raw NTLMSSP" 
(instead it sends NTLMSSP encapsulated in SPNEGO/GSSAPI, which support is not 
complete in the CIFS VFS yet).