[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Symlinks vs. hardlinks



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

On Tue, Jan 05, 2016 at 11:08:11AM +0100, Thomas Schmitt wrote:
> Hi,
> 
> tomas@tuxteam.de wrote:
> > > >   tomas@rasputin:~$ ln /home/test/.profile test-profile
> > > >   ln: failed to create hard link `test-profile' =>
> > > > `/home/test/.profile': Operation not permitted
> 
> Seems to be a new security feature.
> 
> In "man 5 proc" i read
>   "/proc/sys/fs/protected_hardlinks (since Linux 3.6)
>    ...
>    When the value in this file is 1, a hard
>    link  can be created to a target file only if one of the follow‐
>    ing conditions is true:
>    ...
>    *  The caller has the CAP_FOWNER capability.
>    *  The filesystem UID of the process creating the link matches
>       the  owner  (UID) of the target file [...]
>    *  All of the following conditions are true:
>       ...
>       ·  the caller has  permission to read and write the target
>          file
> "
> 
> So it is not enough to have w-permission of the directory where
> the new link shall emerge. Ownership or rw-permission of the target
> file is needed, too.
> 
> The described behavior is in effect here:
> 
>   $ cat /proc/sys/fs/protected_hardlinks
>   1

Thank you for showing this old dog a new trick :-)

> Have a nice day :)

and a happy new year

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

iEYEARECAAYFAlaLk1EACgkQBcgs9XrR2kYpcgCfbnpk3pmfNLNnkmnXVCKScGyH
xIMAmwY99dP6m8vN6h7NJl6ikF+ry4Zu
=FQA0
-----END PGP SIGNATURE-----


Reply to: