一开始是想在linux虚拟机中挂载google drive网盘,但是rclone没怎么接触过,所以试着尝试了一次windows下安装gfs之后把G盘里的文件设置成共享文件夹,linux里挂载该共享文件夹。虽然最终失败了,但是从中也试错了一些东西。故记录如下

  1. linux上挂载共享文件夹

一开始使用

mount -o username="Administrator",password="123456" //172.31.10.1/Calibre-web /root/test

挂载共享文件夹,但是发现报错:(日志文件在/var/log/kern.log)

mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

搜索资料之后发现需要加上参数vers=3.0
其中还发现了需要指定文件系统,参数-t cifs 需要安装cifs-utils

安装完成之后执行命令

mount -t cifs -o username="Administrator",password="123456",vers=3.0 //172.31.10.1/Calibre-web /root/test

报错信息如下

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

继续查阅资料发现其他人也有和我类似的问题,别人从centos7.6升级到7.7后发生这个错误,我使用的是debian9.12系统,我感觉很大概率这个问题是相同的。因为日志报了同样的错误:

kernel: Status code returned 0xc000006d STATUS_LOGON_FAILURE
kernel: CIFS VFS: Send error in SessSetup = -13
kernel: CIFS VFS: cifs_mount failed w/return code = -13

问题出在更新后的版本在通过本地用户鉴权的时候需要指定域,因此我将鉴权的用户密码写在了/root/.smbcredentials里面

username=Administrator
password=123456
domain=172.31.10.1

此时挂载命令如下:

mount -t cifs -o credentials=/root/.smbcredentials,vers=3.0 //172.31.10.1/Calibre-web /root/test

挂载成功。

如果需要开机挂载的话,可以编辑文件/etc/fstab,在最后一行加入:

//172.31.10.1/Calibre-web /root/test cifs credentials=/root/.smbcredentials,file_mode=0777,dir_mode=0777,noperm,_netdev,rw,sec=ntlmssp,iocharset=utf8,soft,uid=10001,gid=1004,vers=3.0 0 0

其中uid和gid代表需要权限的linux用户

挂载成功之后cd /root/test && ls,提示以下错误:

ls: 正在读取目录'.': 函数未实现

此题无解。

参考:github1,github2

Last modification:June 8th, 2020 at 05:32 pm
If you think my article is useful to you, please feel free to appreciate