ユーザー名がwww-dataの空のディレクトリを削除できないのはなぜですか? [コピー]

ユーザー名がwww-dataの空のディレクトリを削除できないのはなぜですか? [コピー]

Testは内容のない空のディレクトリです。

root@localhost:~# ls -l  /home
drwxrwxrwx  2 www-data www-data    4096 Apr 26 17:50 test

root@localhost:~# ls  -l  /home/test
total 0

これで、ユーザー名をルートからwww-dataに変更します。

root@localhost:~# su  www-data
$ rm  -rf  /home/test
rm: cannot remove `/home/test': Permission denied
$ 

testwww-dataに属する空のディレクトリを削除できないのはなぜですか? rootでログインすると削除できます。

root@localhost:~# rm  -rf  /home/test

root@localhost:~# ls -lZ /home/test
total 0
root@localhost:~# getfacl /home/test/
getfacl: Removing leading '/' from absolute path names
# file: home/test/
# owner: www-data
# group: www-data
user::rwx
group::rwx
other::rwx

root@localhost:~# ls -al  /home
total 8352
drwxr-xr-x 10 root     root        4096 Apr 26 17:50 .
drwxr-xr-x 22 root     root        4096 Mar 20 16:32 ..
drwxrwxrwx  2 www-data www-data    4096 Apr 26 17:50 test
root@localhost:~# ls -al  /home/test
total 8
drwxrwxrwx  2 www-data www-data 4096 Apr 26 17:50 .
drwxr-xr-x 10 root     root     4096 Apr 26 17:50 ..
root@localhost:~#

ベストアンサー1

親ディレクトリからエントリを削除するには、親ディレクトリに書き込み権限が必要です。あなたの場合はこれであり、ルートのみが書き込み/homeアクセス権を持っているため、ルートのみがエントリを削除できます。

おすすめ記事