
我的檔案系統上有一個名為「/etc/file.conf」的檔案。
$ getfacl /etc/file.conf
getfacl: Removing leading '/' from absolute path names
# file: etc/file.conf
# owner: root
# group: root
user::rw-
group::r--
other::r--
我希望我的帳戶“userr”具有寫入權限,以便我的 Python 腳本可以寫入它。它由 root 擁有,所以我的想法是創建一個新群組並將其設置為它。
$ sudo groupadd rsnap
$ sudo usermod -a -G rsnap userr
$ id userr
uid=1000(userr) gid=1000(userr) groups=1000(user),27(sudo),1001(rsnap)
$ sudo setfacl -m g:rsnap:rw /etc/file.conf
$ getfacl /etc/file.conf
getfacl: Removing leading '/' from absolute path names
# file: etc/file.conf
# owner: root
# group: root
user::rw-
group::r--
group:rsnap:rw-
mask::rw-
other::r--
然而..
$ echo "Test" >> /etc/file.conf
-bash: /etc/file.conf: Permission denied
我錯過了什麼?
答案1
您修改了/etc/rsnapshot.conf
但您使用 進行了測試/etc/file.conf
。
您仍然需要透過以下方式啟用遮罩:
setfacl -m m:rw- filename
或者
setfacl -m m::rw- filename
取決於作業系統 - 請注意,這種 ACL 從未標準化。 1993 年的相關標準提案於 1997 年撤回。
順便說一句:我只是注意到你的面具可能已經設定好了。所以你仍然使用了錯誤的檔案名稱。
這個過時的 ACL 提案中的問題會經常出現,因為標準提案從未完成,並且一致認為這不是客戶想要的。