4 ms·
because you are modifying the file's inode, which you do not have permission to modify.
by cat199 9y ago
because you are modifying the file's inode, which you do not have permission to modify.
- amelius 9y agoOk, but what does it modify besides the refcount?
- cat199 9y agonot sure. but you don't have permission to modify that inode, hence, no permission to link. the model is pretty straightforward. also, being able to 'create' files 'owned' by another user in other locations (by linking them into place) could create quite a few bizarre and undefined corner cases, some of which might have implications for system stability and/or security.
- jwilk 9y agoBut... traditionally, Unix systems do allow creating hardlinks of other users' files. And yes, this misfeature is a source of great number of security holes. An option to disable this behavior (/proc/sys/fs/protected_hardlinks) was addded only in Linux 3.6, and then it's still disabled by default.
- foobiekr 9y agoconsider what would happen if the file was counted against someone's quota and they rm'd the file but your link was still outstanding.