CIFS mount – fstab与手动 – 丢失写入权限

我有一个安装在启动时的samba共享驱动器,可以按照我的意图运行。 这是fstab文件:

//192.168.1.2/ext4tb /mnt/ext4tb cifs ,credentials=/home/frepie/.smbcredentials,iocharset=utf8,vers=1.0,sec=ntlm,user 0 0 

当这种方法正常工作时,我对该共享具有完全的读,写和执行权限

有时,由于我忽略的原因,共享驱动器未在引导时挂载。 尝试在不重新启动的情况下解决问题,我使用了该命令

 sudo mount.cifs //192.168.1.2/ext4tb /mnt/ext4tb 

该命令在samba服务器上请求root密码

 Password for root@//192.168.1.2/ext4tb: ******** 

问题是,当这样做时,我没有在启动时挂载正常工作时的写权限。

 $ mv /home/frepie/Music/Dark\ Latin\ Groove\ -\ La\ Quiero\ A\ Morir /mnt/ext4tb/media/Audio/ mv: cannot create regular file '/mnt/ext4tb/media/Audio/Dark Latin Groove - La Quiero A Morir': Permission denied 

不知何故,在启动时由fstab执行挂载时,我没有被授予相同的权限。

据我所知,你正在寻找的行为(即查阅/etc/fstab文件,并应用那里找到的选项)仅适用于直接调用mount ,而不是像mount.cifs这样的“helper”命令之一mount.cifs ,仅当您指定EITHER设备或挂载点时。 从man mount

  If only the directory or the device is given, for example: mount /dir then mount looks for a mountpoint (and if not found then for a device) in the /etc/fstab file. It's possible to use the --target or --source options to avoid ambivalent interpretation of the given argument. For example: mount --target /mountpoint 

所以更换

 sudo mount.cifs //192.168.1.2/ext4tb /mnt/ext4tb 

两者之一

 sudo mount /mnt/ext4tb 

要么

 sudo mount //192.168.1.2/ext4tb 

嗨,我做的完全相同:在/etc/fstab声明的smb共享,除了不自动挂载,我将凭证文件存储在加密文件夹中。 我没有遇到任何问题。

这是18.04上的/etc/fstab的摘录

 //192.168.1.100/video /media/user/Video cifs noauto,user,_netdev,sec=ntlm,credentials=/home/user/Crypt/credentials,uid=1000,gid=1000,vers=1.0 0 0 

uid=1000,gid=1000

您可以添加thoses选项:明确指定您的Ubuntu用户的用户ID

使用我喜欢的noauto选项,当我点击从nautilus文件管理器打开它们时,会挂载共享。

使用_netdev选项意味着此安装需要网络

似乎答案是简单地安装没有CIF的驱动器即

 sudo mount /mnt/ext4tb