Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #162649

Re: Symlinks vs. hardlinks [was: Prevent shutdown with systemctl]

From <tomas@tuxteam.de>
Newsgroups linux.debian.user
Subject Re: Symlinks vs. hardlinks [was: Prevent shutdown with systemctl]
Date 2016-01-05 16:30 +0100
Message-ID <qNBIC-4FF-31@gated-at.bofh.it> (permalink)
References (3 earlier) <qNjVp-8lm-23@gated-at.bofh.it> <qNkHM-sc-9@gated-at.bofh.it> <qNlaP-Er-23@gated-at.bofh.it> <qNvjP-7VD-11@gated-at.bofh.it> <qNBIC-4FF-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Jan 05, 2016 at 09:19:57AM -0600, David Wright wrote:
> On Tue 05 Jan 2016 at 09:04:19 (+0100), tomas@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:

You are too polite. What I wrote is plainly wrong on a second look.
Sorry. Yes, the metadata is in the inode and not in the directory
entry.

> 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).

Spot on. Thanks for the correction (and for your politeness :)

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlaL2TEACgkQBcgs9XrR2kY9KQCffkTMtTA1gt0qLt94NUM9subh
VBoAn195zfUGSv9DVwjFmZCstTQTKSRZ
=mjYZ
-----END PGP SIGNATURE-----

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Prevent shutdown with systemctl Floris <jkfloris@dds.nl> - 2016-01-04 17:00 +0100
  Re: Prevent shutdown with systemctl Michael Biebl <biebl@debian.org> - 2016-01-04 18:20 +0100
    Re: Prevent shutdown with systemctl Floris <jkfloris@dds.nl> - 2016-01-04 20:10 +0100
      Re: Prevent shutdown with systemctl Floris <jkfloris@dds.nl> - 2016-01-04 21:00 +0100
        Re: Prevent shutdown with systemctl Michael Biebl <biebl@debian.org> - 2016-01-04 21:20 +0100
      Re: Prevent shutdown with systemctl Brian <ad44@cityscape.co.uk> - 2016-01-04 21:50 +0100
        Re: Prevent shutdown with systemctl Floris <jkfloris@dds.nl> - 2016-01-04 23:50 +0100
          Re: Prevent shutdown with systemctl Michael Biebl <biebl@debian.org> - 2016-01-05 00:50 +0100
            Re: Prevent shutdown with systemctl Brian <ad44@cityscape.co.uk> - 2016-01-05 01:30 +0100
              Re: Prevent shutdown with systemctl Michael Biebl <biebl@debian.org> - 2016-01-05 01:40 +0100
  Re: Prevent shutdown with systemctl Gary Dale <garydale@torfree.net> - 2016-01-04 18:20 +0100
    Re: Prevent shutdown with systemctl <tomas@tuxteam.de> - 2016-01-04 18:50 +0100
      Re: Prevent shutdown with systemctl Stuart Longland <stuartl@longlandclan.id.au> - 2016-01-04 21:20 +0100
        Re: Prevent shutdown with systemctl Gary Dale <garydale@torfree.net> - 2016-01-04 21:40 +0100
          Re: Prevent shutdown with systemctl Stuart Longland <stuartl@longlandclan.id.au> - 2016-01-04 22:10 +0100
            Re: Prevent shutdown with systemctl Gary Dale <garydale@torfree.net> - 2016-01-04 22:50 +0100
              Re: Prevent shutdown with systemctl Michael Biebl <biebl@debian.org> - 2016-01-05 01:20 +0100
                Re: Prevent shutdown with systemctl Gary Dale <garydale@torfree.net> - 2016-01-05 18:20 +0100
      Re: Prevent shutdown with systemctl Gary Dale <garydale@torfree.net> - 2016-01-04 21:30 +0100
        Re: Prevent shutdown with systemctl Stuart Longland <stuartl@longlandclan.id.au> - 2016-01-04 22:00 +0100
          Re: Prevent shutdown with systemctl David Wright <deblis@lionunicorn.co.uk> - 2016-01-05 05:50 +0100
        Re: Prevent shutdown with systemctl <tomas@tuxteam.de> - 2016-01-04 22:20 +0100
          Re: Prevent shutdown with systemctl Gary Dale <garydale@torfree.net> - 2016-01-04 22:50 +0100
            Re: Prevent shutdown with systemctl David Wright <deblis@lionunicorn.co.uk> - 2016-01-05 06:10 +0100
            Symlinks vs. hardlinks [was: Prevent shutdown with systemctl] <tomas@tuxteam.de> - 2016-01-05 09:40 +0100
              Re: Symlinks vs. hardlinks "Thomas Schmitt" <scdbackup@gmx.net> - 2016-01-05 11:10 +0100
                Re: Symlinks vs. hardlinks <tomas@tuxteam.de> - 2016-01-05 11:40 +0100
              Re: Symlinks vs. hardlinks [was: Prevent shutdown with systemctl] <tomas@tuxteam.de> - 2016-01-05 16:30 +0100
              Re: Symlinks vs. hardlinks [was: Prevent shutdown with systemctl] David Wright <deblis@lionunicorn.co.uk> - 2016-01-05 16:30 +0100
  Re: Prevent shutdown with systemctl Jude DaShiell <jdashiel@panix.com> - 2016-01-04 19:20 +0100
  Re: Prevent shutdown with systemctl Brian <ad44@cityscape.co.uk> - 2016-01-04 19:30 +0100
    Re: Prevent shutdown with systemctl jdd <jdd@dodin.org> - 2016-01-04 20:10 +0100
      Re: Prevent shutdown with systemctl jdd <jdd@dodin.org> - 2016-01-04 20:30 +0100
      Re: Prevent shutdown with systemctl Chris Bannister <cbannister@slingshot.co.nz> - 2016-01-05 11:10 +0100

csiph-web