挂载共享CIF上的始终许可777 [英] Always permission 777 on mount shared cifs
问题描述
当我从Synology NAS挂载SMB共享文件夹时,我遇到了一个小问题.
我想挂载具有以下权限的共享文件夹:git:root 700
I have a little problem when I mount a SMB shared folder from a Synology NAS.
I want to mount a shared folder with permissions: git:root 700
但是已安装的文件夹的权限始终设置为777(即使在chmod 700之后也没有错误)
But the mounted folder always have permission set to 777 ( even after a chmod 700 without error)
在我的/etc/fstab
中,我使用了以下行:
In my /etc/fstab
I used this line:
#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
您知道为什么我不能将我的权利设置为700吗? 我做错了吗?有点愚蠢吗?
Do you know why I cannot set my rights to 700 ? I did a mistake ? Something stupid ?
在此先感谢您的帮助;)
Thanks in advance for your help ;)
推荐答案
您的问题很常见.您使用的标签不正确,才能更改已安装文件夹的文件权限.
Your problem is a very common one. You are using incorrect tags to be able to change the file permissions of the mounted folder.
您需要添加'umask =',而不是使用时的'file_mode = 700'和'dir_mode = 700'系统安装选项而不是CIFS的选项.
You need to add 'umask=', instead of 'file_mode=700' and 'dir_mode=700' as it is using system mount options not CIFS's options.
为此,您可以使用:
//address/location /mount/location cifs credentials=/location,uid=id,gid=id,umask=700 0 0
这将在设置的文件权限下挂载文件共享.
This will mount the file share under the set file permissions.
出于安全性考虑,我建议使用凭证文件,该文件包含用户名和密码,并且必须设置为只读.
For security I would recommend using a credentials file, which contains the username and password, and must be set as read only.
这篇关于挂载共享CIF上的始终许可777的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!