📄 readme
字号:
The CIFS VFS support for Linux supports many advanced network filesystem features such as hierarchical 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 servers. For questions or bug reports please contact: sfrench@samba.org (sfrench@us.ibm.com) Build instructions:==================For Linux 2.4:1) Get the kernel source (e.g.from http://www.kernel.org)and download the cifs vfs source (see the project pageat http://us1.samba.org/samba/Linux_CIFS_client.html)and change directory into the top of the kernel directorythen patch the kernel (e.g. "patch -p1 < cifs_24.patch") to add the cifs vfs to your kernel configure options ifit has not already been added (e.g. current SuSE and ULusers do not need to apply the cifs_24.patch since the cifs vfs isalready in the kernel configure menu) and thenmkdir linux/fs/cifs and then copy the current cifs vfs files fromthe cifs download to your kernel build directory e.g. cp <cifs_download_dir>/fs/cifs/* to <kernel_download_dir>/fs/cifs 2) make menuconfig (or make xconfig)3) select cifs from within the network filesystem choices4) save and exit5) make dep6) make modules (or "make" if CIFS VFS not to be built as a module)For Linux 2.6:1) Download the kernel (e.g. from http://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 choices4) save and exit5) makeInstallation instructions:=========================If you have built the CIFS vfs as module (successfully) simplytype "make modules_install" (or if you prefer, manually copy the file tothe 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 instructionsfor your distribution on how to install a new kernel (usually youwould simply type "make install").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 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 forusers 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 yourLinux clients is useful in mapping Uids and Gids consistently across thedomain to the proper network user. The mount.cifs mount helper can betrivially built from Samba 3.0 or later source e.g. by executing: gcc samba/source/client/mount.cifs.c -o mount.cifsIf cifs is built as a module, then the size and number of network buffersand maximum number of simultaneous requests to one server can be configured.Changing these from their defaults is not recommended. By executing modinfo modinfo kernel/fs/cifs/cifs.koon kernel/fs/cifs/cifs.ko the list of configuration changes that can be madeat module initialization time (by running insmod cifs.ko) can be seen.Allowing User Mounts====================To permit users to mount and unmount over directories they own is possiblewith the cifs vfs. A way to enable such mounting is to mark the mount.cifsutility as suid (e.g. "chmod +s /sbin/mount.cifs). To enable users to umount shares they mount requires1) mount.cifs version 1.4 or later2) an entry for the share in /etc/fstab indicating that a user mayunmount it e.g.//server/usersharename /mnt/username cifs user 0 0Note 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 todisallow 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 enabledby 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.cifsThere is a corresponding manual page for cifs mounting in the Samba 3.0 andlater source tree in docs/manpages/mount.cifs.8 Allowing User Unmounts======================To permit users to ummount directories that they have user mounted (see above),the utility umount.cifs may be used. It may be invoked directly, or if umount.cifs is placed in /sbin, umount can invoke the cifs umount helper(at least for most versions of the umount utility) for umount of cifsmounts, unless umount is invoked with -i (which will avoid invoking a umounthelper). As with mount.cifs, to enable user unmounts umount.cifs must be markedas suid (e.g. "chmod +s /sbin/umount.cifs") or equivalent (some distributionsallow adding entries to a file to the /etc/permissions file to achieve theequivalent suid effect). For this utility to succeed the target pathmust be a cifs mount, and the uid of the current user must match the uidof the user who mounted the resource.Also note that the customary way of allowing user mounts and unmounts is (instead of using mount.cifs and unmount.cifs as suid) to add a lineto the file /etc/fstab for each //server/share you wish to mount, butthis can become unwieldy when potential mount targets include manyor unpredictable UNC names.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 2.2.5 or later). To enable the Unix CIFS Extensions in the Samba server, add the line: unix extensions = yes 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: case sensitive = yes delete readonly = yes ea support = yesNote that server ea support is required for supporting xattrs from the Linuxcifs client, and that EA support is present in later versions of Samba (e.g. 3.0.6 and later (also EA support works in all versions of Windows, at least toshares on NTFS filesystems). Extended Attribute (xattr) support is an optionalfeature of most Linux filesystems which may require enabling viamake menuconfig. Client support for extended attributes (user xattr) can bedisabled on a per-mount basis by specifying "nouser_xattr" on mount.The CIFS client can get and set POSIX ACLs (getfacl, setfacl) to Samba serversversion 3.10 and later. Setting POSIX ACLs requires enabling both XATTR and then POSIX support in the CIFS configuration options when building the cifsmodule. POSIX ACL support can be disabled on a per mount basic by specifying"noacl" on mount. Some administrators may want to change Samba's smb.conf "map archive" and "create mask" parameters from the default. Unless the create mask is changednewly created files can end up with an unnecessarily restrictive default mode,which may not be what you want, although if the CIFS Unix extensions areenabled on the server and client, subsequent setattr calls (e.g. chmod) canfix the mode. Note that creating special devices (mknod) remotely may require specifying a mkdev function to Samba if you are not using Samba 3.0.6 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 (the few optional settings are passed in on mount via -o parameters instead). Note that Samba 2.2.7 or later includes a fix that allows the CIFS VFS to deleteopen files (required for strict POSIX compliance). Windows Servers already supported this feature. Samba server does not allow symlinks that refer to filesoutside of the share, so in Samba versions prior to 3.0.6, most symlinks tofiles with absolute paths (ie beginning with slash) such as: ln -s /mnt/foo barwould be forbidden. Samba 3.0.6 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 serverthat is ignored by local server applications and non-cifs clients and that willnot be traversed by the Samba server). This is opaque to the Linux clientapplication using the cifs vfs. Absolute symlinks will work to Samba 3.0.5 orlater, but only for remote clients using the CIFS Unix extensions, and willbe invisbile to Windows clients and typically will not affect localapplications running on the same server as Samba. Use instructions:================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: mount -t cifs //9.53.216.11/e$ /mnt -o user=myname,pass=mypasswordBefore -o the option -v may be specified to make the mount.cifsmount helper display the mount steps more verbosely. After -o the following commonly used cifs vfs specific optionsare supported: user=<username> pass=<password> domain=<domain name> Other cifs mount options are described below. Use of TCP names (in addition toip addresses) is available if the mount helper (mount.cifs) is installed. Ifyou do not trust the server to which are mounted, or if you do not havecifs signing enabled (and the physical network is insecure), consider useof the standard mount options "noexec" and "nosuid" to reduce the risk of running an altered binary on your local system (downloaded from a hostile serveror altered by a hostile router).Although mounting using format corresponding to the CIFS URL specification isnot possible in mount.cifs yet, it is possible to use an alternate formatfor the server and sharename (which is somewhat similar to NFS style mountsyntax) instead of the more widely used UNC format (i.e. \\server\share): mount -t cifs tcp_name_of_server:share_name /mnt -o user=myname,pass=mypasswdWhen using the mount helper mount.cifs, passwords may be specified via alternate
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -