← 返回命令列表

Linux command

mount.cifs 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Mount SMB share

sudo mount.cifs -o user=[username] //[server]/[share] [mountpoint]

Example

sudo mount.cifs -o guest //[server]/[share] [mountpoint]

Example

sudo mount.cifs -o uid=[user],gid=[group] //[server]/[share] [mountpoint]

Example

sudo mount.cifs -o credentials=[path/to/credentials] //[server]/[share] [mountpoint]

Example

sudo mount.cifs -o vers=3.0 //[server]/[share] [mountpoint]

Example

sudo mount.cifs -o ro //[server]/[share] [mountpoint]

说明

mount.cifs mounts CIFS (Common Internet File System) or SMB (Server Message Block) network shares on Linux. It connects to Windows file shares, Samba servers, and NAS devices using the //server/share UNC syntax. The utility is typically invoked through the mount command with -t cifs option. It requires Linux kernel CIFS filesystem support. Authentication can use username/password, Kerberos, or guest access.

参数

user=_username_
Login username; defaults to USER environment variable
password=_pass_
Login password; uses PASSWD variable if unset
credentials=_file_
File containing username, password, and domain
guest
Connect without password prompt
domain=_name_
Windows domain or workgroup name
uid=_id_
Set owner UID for files when server provides none
gid=_id_
Set owner GID for files when server provides none
file_mode=_mode_
Override default file permissions (e.g., 0644)
dir_mode=_mode_
Override default directory permissions (e.g., 0755)
vers=_version_
SMB protocol version: 1.0, 2.0, 2.1, 3.0, 3.02, 3.1.1
sec=_mode_
Security mode: none, krb5, ntlm, ntlmv2, ntlmssp
seal
Request SMB-layer encryption (requires SMB3+)
cache=_mode_
Caching mode: none, strict, loose
ro
Mount read-only
rw
Mount read-write (default)
noperm
Disable client-side permission checks
cifsacl
Map CIFS/NTFS ACLs to Linux permissions

FAQ

What is the mount.cifs command used for?

mount.cifs mounts CIFS (Common Internet File System) or SMB (Server Message Block) network shares on Linux. It connects to Windows file shares, Samba servers, and NAS devices using the //server/share UNC syntax. The utility is typically invoked through the mount command with -t cifs option. It requires Linux kernel CIFS filesystem support. Authentication can use username/password, Kerberos, or guest access.

How do I run a basic mount.cifs example?

Run `sudo mount.cifs -o user=[username] //[server]/[share] [mountpoint]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does user=_username_ do in mount.cifs?

Login username; defaults to USER environment variable