A friend of mine has one directory (/var/mail) on his Linux machine where
rm seems to truncate files if he has no write permissions on the directory. I like this feature and wonder how could I do the same on my Linux box?
This is the behavior what I want:
$ mkdir /tmp/nase $ echo "something" > /tmp/nase/bla $ chmod ugo-w /tmp/nase # ...do some more tricks with /tmp/nase ... $ rm /tmp/nase/bla rm: cannot remove ‘/tmp/nase/bla’: Permission denied # but the file is truncated now: $ stat -c '%s' /tmp/nase/bla 0
On my friends machine /var/mail is an NFS mount with these permissions:
drwxrwsr-x 2 root postdrop 4096 Dec 8 2005
The NFS server is probably a SUN machine.
One more general technical NFS question: Does the "permission denied" error come from the client only or from server?