root
ユーザーできるwrite
権限が設定されていない場合でもファイルに書き込みます。
root
ユーザーできるread
権限が設定されていない場合でもファイルを読んでください。
root
ユーザーできる cd
execute
権限が設定されていない場合でもディレクトリを入力してください。
root
ユーザーできないexecute
ファイル権限が設定されていない場合は、ファイルを実行します。
なぜ?
user$ echo '#!'$(which bash) > file
user$ chmod 000 file
user$ ls -l file
---------- 1 user user 12 Jul 17 11:11 file
user$ cat file # Normal user cannot read
cat: file: Permission denied
user$ su
root$ echo 'echo hello' >> file # root can write
root$ cat file # root can read
#!/bin/bash
echo hello
root$ ./file # root cannot execute
bash: ./file: Permission denied
ベストアンサー1
つまり、実行ビットが設定されていない場合は特殊と見なされるためです。別の言葉、そのファイルは実行ファイルではないと見なされ、実行できません。
ただし、ルートは実行ビットが設定されていても実行でき、実行されます。
観察する:
caleburn: ~/ >cat hello.sh
#!/bin/sh
echo "Hello!"
caleburn: ~/ >chmod 000 hello.sh
caleburn: ~/ >./hello.sh
-bash: ./hello.sh: Permission denied
caleburn: ~/ >sudo ./hello.sh
sudo: ./hello.sh: command not found
caleburn: ~/ >chmod 100 hello.sh
caleburn: ~/ >./hello.sh
/bin/sh: ./hello.sh: Permission denied
caleburn: ~/ >sudo ./hello.sh
Hello!