why root is getting denied here?
by lvm_ from LinuxQuestions.org on (#6PH85)
A directory 0 with a sticky bit is owned by root, has 1755 access mode and has a file q inside owned by plain user. Root (i.e. from 'sudo bash') has no problem writing to this file. Obviously.
Code:root@server:/tmp# ls -ld 0
drwxr-xr-t 2 root root 4096 Jul 26 21:44 0
root@server:/tmp# ls -l 0
total 0
-rw-r--r-- 1 lvm lvm 0 Jul 26 21:48 q
root@server:/tmp# >0/qNow let's change directory mode to less restrictive 1777 - and root no longer can write to this file. Why?
Code:root@server:/tmp# chmod 1777 0
root@server:/tmp# ls -ld 0
drwxrwxrwt 2 root root 4096 Jul 26 21:44 0
root@server:/tmp# >0/q
bash: 0/q: Permission denied
Code:root@server:/tmp# ls -ld 0
drwxr-xr-t 2 root root 4096 Jul 26 21:44 0
root@server:/tmp# ls -l 0
total 0
-rw-r--r-- 1 lvm lvm 0 Jul 26 21:48 q
root@server:/tmp# >0/qNow let's change directory mode to less restrictive 1777 - and root no longer can write to this file. Why?
Code:root@server:/tmp# chmod 1777 0
root@server:/tmp# ls -ld 0
drwxrwxrwt 2 root root 4096 Jul 26 21:44 0
root@server:/tmp# >0/q
bash: 0/q: Permission denied