When I create a file with no write permissions in my home directory:
$ umask 777; touch testfile
$ ls -ln testfile
---------- 1 1000 1000 0 2014-03-21 16:52 testfile
$
..then I'm still easily able to remove that file:
$ rm -fv testfile
removed `testfile'
$
When I create a file with no write permissions to a directory where I don't have write permissions, then I'm not able to remove such file:
$ ls -lnd /var/
drwxr-xr-x 14 0 0 4096 2014-03-21 17:04 /var/
$ ls -ln /var/testfile
---------- 1 1000 1000 0 2014-03-21 17:04 /var/testfile
$ rm -vf /var/testfile
rm: cannot remove `/var/testfile': Permission denied
$
Am I correct that write permissions are inherited from parent directory? Is it true for read and execute permissions as well?
cd
into it, but not runls
from inside it. I don't thingcd
requires any permission at all, actually. – Brilliand Mar 21 '14 at 19:07