On Tue 05 Jan 2016 at 09:04:19 (+0100), to...@tuxteam.de wrote: > On Mon, Jan 04, 2016 at 04:43:05PM -0500, Gary Dale wrote: > > If that is a problem with symlinks, shouldn't it also be with > > hardlinks? > > No, because of above: > > - symlink: permissions of linked-to file apply. Symlink has no "own" > permissions. When linked-to file is removed, symlink is dangling. > > - hardlink: each has its own metadata (permissions, etc.). All hardlinks > are equivalent. When last link to a file's data is removed, storage > is recycled.
That could be interpreted ambiguously. To clarify, the metadata is stored in the inode, so all the hard links to a particular file/inode share the same information, thus: 07:45 $ touch foo 07:45 $ ls -li [fb]* 488715 -rw-r----- 1 david david 0 Jan 5 07:45 foo 07:45 $ ln foo bar 07:55 $ ls -li [fb]* 488715 -rw-r----- 2 david david 0 Jan 5 07:45 bar 488715 -rw-r----- 2 david david 0 Jan 5 07:45 foo 07:55 $ chmod a+r bar 07:57 $ ls -li [fb]* 488715 -rw-r--r-- 2 david david 0 Jan 5 07:45 bar 488715 -rw-r--r-- 2 david david 0 Jan 5 07:45 foo 07:57 $ touch bar 07:57 $ ls -li [fb]* 488715 -rw-r--r-- 2 david david 0 Jan 5 07:57 bar 488715 -rw-r--r-- 2 david david 0 Jan 5 07:57 foo 07:57 $ ls -li [fb]* 488715 -rw-r--r-- 2 david david 0 Jan 5 07:57 bar 488715 -rw-r--r-- 2 david david 0 Jan 5 07:57 foo 07:58 $ # chown nobody /tmp/bar 07:58 $ ls -li [fb]* 488715 -rw-r--r-- 2 nobody david 0 Jan 5 07:57 bar 488715 -rw-r--r-- 2 nobody david 0 Jan 5 07:57 foo 07:59 $ Each symlink has its own metadata in its inode, but most of it is ignored most of the time (eg ownership), or can't be changed (eg permissions). > They are different concepts, differently implemented. Functionality is > somewhat overlapping, that's why in some situations they can be used > for similar purposes, but for some other things they are radically > different. Cheers, David.