从 linux 更改 windows 挂载文件夹的权限

har*_*ava 2 mount samba cifs mountpoint

我使用

mount -t cifs -o username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt
Run Code Online (Sandbox Code Playgroud)

我成功安装了它。从 Linux 我尝试更改已安装文件夹的权限,然后它给了我错误。

chmod:更改“/mnt/”的权限:权限被拒绝

chmod -R 777 /mnt
Run Code Online (Sandbox Code Playgroud)

如何在 Linux 中更改挂载文件夹的权限?

是否可以通过 Linux 命令(chmod)更改已安装的 Windows 文件夹的权限?

Mor*_*us1 6

是否可以通过 Linux 命令(chmod)更改已安装的 Windows 文件夹的权限?

不。CIFS 很像 NTFS 是一个虚拟文件系统,所以 chmod 没有影响。并且在挂载任何东西之前更改挂载点的权限也不会产生任何影响,因为挂载后的权限总是会替换挂载之前的权限。

如果所需的权限是 777,请更改您的挂载命令以包含这些权限:dir_mode=0777,file_mode=0777. 我也会养成添加nounix选项的习惯,尽管对于 Windows 共享来说它不会做太多。

所以试试这个:

mount -t cifs -o username=<share user>,password=<share password>,dir_mode=0777,file_mode=0777,nounix //WIN_PC_IP/<share name> /mnt
Run Code Online (Sandbox Code Playgroud)

我同意一个更好的挂载点应该在 /mnt 下而不是 /mnt 本身。