So what't the rationale behind this? (I'm on Ubuntu 15.10)
I can't increase the ref count on a file owned by root (-> Operation not permitted). Which makes sense, since as "user" I don't have write permission to modify the refcount on the inode:
$ mkdir /tmp/dir1 $ cd /tmp/dir1 $ sudo touch file-owned-by-root [sudo] password for user: $ ls -l total 0 -rw-r--r-- 1 root root 0 jun 2 8:01 file-owned-by-root $ ln file-owned-by-root hlink-to-file-owned-by-root ln: failed to create hard link ‘hlink-to-file-owned-by-root’ => ‘file-owned-by-root’: Operation not permitted user
But I can delete (thus: decrease ref count) a root owned file if "user" has write access to parent directory:
$ rm file-owned-by-root rm: remove write-protected regular empty file ‘file-owned-by-root’? y $ ls -l file-owned-by-root ls: cannot access file-owned-by-root: No such file or directory
Shouldn't decreasing the refcount of "file-owned-by-root" be equally denied, since as "user" I don't have write permission to the file?
[link] [comments]