挂载 samba 共享时出错,无法挂载块设备 xxxx 只读

Jef*_*ard 12 samba smbfs cifs ubuntu

安装 Ubuntu 12.04 后,我尝试使用始终有效且服务器未更改的脚本命令在 Linux 下从 Windows 挂载 samba 共享。

错误如下:

$ mount -t cifs //<host>/<share> /media/<share> -o username=<user>,password=<pass>
mount: block device //<host>/<share> is write-protected, mounting read-only
mount: cannot mount block device //<host>/<share> read-only
$
Run Code Online (Sandbox Code Playgroud)

我已经阅读了很多关于权限的讨论,但不幸的是,这不是问题所在。我在下面提交我自己的答案以供参考,希望这对其他人有所帮助。

Jef*_*ard 13

鉴于解决方案,错误消息完全具有误导性(无论如何,对我来说,我确信权限问题可能会困扰其他人,但在我的情况下,这是一个始终有效的脚本和一个没有改变的服务器 - 只有客户端操作系统已更改)。我的解决方案是缺少 cifs-utils 包,如缺少文件 /sbin/mount.cifs 所示

$ ls /sbin/mount.cifs
ls: cannot access /sbin/mount.cifs: No such file or directory
$ mount.cifs
The program 'mount.cifs' is currently not installed.  You can install it by typing:
apt-get install cifs-utils
Run Code Online (Sandbox Code Playgroud)

使用上述命令安装 cifs-utils 后,挂载工作正常。

我意识到在没有 /sbin/mount.cifs 的情况下使用 mount -t cifs 是一个愚蠢的错误,但错误消息完全具有误导性。我在这台客户端机器上安装了一个 Samba 服务器,所以也许这就是它混淆的原因。