getfacl, setfaclの使い方
概要
- linuxのデフォルトの権限管理以上にコントロールできる
- 通常の管理権限より細かく、設定されているかは
ls -lで確認できる
インストール
debian, ubuntu
$ sudo apt install alc
ACLのエントリを保存したままコピー・圧縮
cp -a ...tar --acls -cf ...
getfacl
概要
- 権限の状況を確認する
エントリのフォーマット
<ugo>:name:<rwx->ugou- ユーザ
g- グループ
o- その他
- name
- ユーザ名、省略可
r- 読み込み
w- 書き込み
x- 実行
-- すべて無効
例
aのファイルの権限の確認
$ getfacl ~/a
getfacl: Removing leading '/' from absolute path names
# file: home/<user>/.tmp/a
# owner: <user>
# group: <user>
user::rw-
user:root:---
group::rw-
mask::rw-
other::---
setfacl
概要
- 権限を変更する
引数
-m- 指定したエントリを追加・変更
-x- エントリの削除
-b- すべてのACLエントリを削除
-d- 指定したACLをデフォルトに設定
例
aのファイルの権限の変更
$ setfacl -m u:<user>:rwx,o:- ~/.tmp/a
$ getfacl ~/.tmp/a
getfacl: Removing leading '/' from absolute path names
# file: home/<user>/.tmp/a
# owner: <user>
# group: <user>
user::rw-
user:root:---
user:<user>:rwx
group::rw-
mask::rwx
other::---