The process is like the following root
is a file whose owner is root
:
~$ ln root another_file
~$ ls -l another_file
-rw-r--r-- 2 root root 0 Jan 24 15:48 another_file
~$ rm another_file
rm: remove write-protected regular empty file `another_file'? y
~$ ls -l another_file
However, this won't work..
~$ ln root another_file
~$ chmod a+w another_file
chmod: changing permissions of `another_file': Operation not permitted
This is one of the unix priciples. It is perfectly all right. The reason simply is that you have write permission to the directory itself. That grants you control over all entries contained in that directory. You'd have a huge problem otherwise. Note that this rule is not limited to hard links, but to every entry in general.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With