2016-11-07 56 views
1

我從Synology NAS掛載SMB共享文件夾時遇到了一些問題。 我想掛載有權限的共享文件夾:git:root 700總是允許777掛載共享CIF

但安裝文件夾始終有權限設置爲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 

你知道我爲什麼不能將我的權利設置爲700嗎? 我犯了一個錯誤?有什麼愚蠢的東西?

預先感謝你的幫助;)

回答

0

你的問題是一個非常通用的沒有。您正在使用不正確的標記來更改已裝入文件夾的文件權限。

您需要添加'的umask =',而不是'file_mode = 700''dir_mode = 700'因爲它是使用系統安裝選項不CIFS的選項。

要做到這一點,你可以使用:

//address/location /mount/location cifs credentials=/location,uid=id,gid=id,umask=700 0 0 

這將安裝下的文件權限設置文件共享。

爲了安全起見,我建議使用憑證文件,其中包含用戶名和密碼,並且必須設置爲只讀。

+0

嗨@ MrEditor97,我嘗試過使用'umask',但是產生了'Invalid argument'錯誤。 '// server/folder/mnt/artifacts cifs credentials =/root/.smbcredentials,gid = 0,uid = 999,iocharset = utf8,umask = 700 0 0' [看起來](https:// superuser.com/questions/698422/why-does-this-line-in-my-fstab-give-me-an-invalid-argument-error)'umask'不能與cif一起使用。 – David

+1

Hi @David, 對不起,你仍然有問題。我剛剛引用了我的設置,並使用您想要的權限安裝CIFS共享,您必須使用'file_mode = 0600,dir_mode = 0700'。因此,我使用的是Samba共享(強制使用正確的文件權限),所以我不必像現在這樣做。 是否有可能強制您的共享上正確的文件權限? 我可以說的唯一的事情是嘗試使用'file_mode =和dir_mode ='加上一個** 0 ** infront的掛載? – MrEditor97

+0

嗨@ MrEditor97,首先感謝您的回答;)不幸的是,我仍然遇到了添加0的問題。但我在我的NAS中找到了一個解決方案,所以現在它正在運行:D 感謝大家;) – David

2

一個良好的開端是檢查出來的聯機幫助頁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. 
[...] 

如此以來,file_mode(和dir_mode)似乎只在服務器工作是否不是支持CIFS Unix擴展,我會先禁用它們(通過nounix選項)

+0

感謝您的anwser;)我已經嘗試添加'nounix'選項(並刪除文件/ dir_mode),但是這會產生一個'沒有這樣的文件或目錄'的錯誤。 – David

相關問題