环境:

爱快版本: 免费版3.7.10 x64 Build202401231339
Linux系统: CentOS7.9
cifs-utils版本: 6.2-10.el7.x86_64

一般情况下,想要在Linux挂载SMB共享, 直接安装cifs-utils,然后执行以下代码就可以挂载上了

sudo mount -t cifs -o username=linux,password=password //192.168.1.1/data /smb_share

但是我在执行的时候一直提示

mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

开始我还以为是我那里配置错了. 后来检查的时候在/var/log/messages,发现这么一行提示

localhost kernel: CIFS VFS: cifs_mount failed w/return code = -22
Feb 25 20:29:24 localhost kernel: No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.

得知是协议版本的问题, 然后在挂载的时候指定下协议版本就解决了.

指定版本为1.0

sudo mount -t cifs //192.168.1.1/data /mnt/smb_share -o username=linux,password=password,vers=2.0

永久挂载, 在/etc/fstab文件里添加以下内容

//192.168.1.1/data /mnt/smb_share cifs username=linux,password=password,vers=2.0 0 0