Dav*_*vid 6 permissions smb debian mount cifs
当我从 Synology NAS 装载 SMB 共享文件夹时,我遇到了一个小问题。我想挂载一个具有权限的共享文件夹:git:root 700
但是挂载的文件夹始终将权限设置为 777(即使在 chmod 700 之后也没有错误)
在我的/etc/fstab我用这一行:
#uid=999 ---> git user
//server/folder /mnt/artifacts cifs username=windowsUser,password=xxxxx,gid=0,uid=999,file_mode=0700,dir_mode=0700,iocharset=utf8 0 0
Run Code Online (Sandbox Code Playgroud)
你知道为什么我不能将我的权限设置为 700 吗?我做错了吗?有什么蠢事?
在此先感谢您的帮助 ;)
如果远程机器用户 ID 和本地机器用户 ID 不匹配,权限将默认为 777。Mount.cifs 不支持 umask,因此可以使用“noperm”选项。这样即使本地和远程机器上的用户权限不匹配,用户仍然可以读写文件夹,相当于umask=000。
//address/location /mount/location cifs username=username,password=password,noperm,vers=2.0 0 0
Run Code Online (Sandbox Code Playgroud)
一个好的开始是查看联机帮助页CIFS:
$ man mount.cifs
[...]
file_mode=arg
If the server does not support the CIFS Unix extensions this overrides the default file mode.
dir_mode=arg
If the server does not support the CIFS Unix extensions this overrides the default mode for directories.
[...]
nounix
Disable the CIFS Unix Extensions for this mount.
[...]
Run Code Online (Sandbox Code Playgroud)
如此以来,file_mode(和dir_mode)似乎只工作如果服务器不支持CIFS Unix的扩展,我想通过禁止它们(通过启动nounix选项)
MrE*_*r97 -3
你的问题是一个很常见的问题。您使用了不正确的标签来更改已安装文件夹的文件权限。
您需要添加'umask=',而不是'file_mode=700'和'dir_mode=700',因为它使用系统安装选项而不是 CIFS 选项。
为此,您可以使用:
//address/location /mount/location cifs credentials=/location,uid=id,gid=id,umask=700 0 0
Run Code Online (Sandbox Code Playgroud)
这将在设置的文件权限下安装文件共享。
为了安全起见,我建议使用凭据文件,其中包含用户名和密码,并且必须设置为只读。
| 归档时间: |
|
| 查看次数: |
25090 次 |
| 最近记录: |