挂载共享 cif 的权限始终为 777 [英] Always permission 777 on mount shared cifs

查看:52
本文介绍了挂载共享 cif 的权限始终为 777的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆