On 01/30/2017 01:05 PM, Patrick McLean wrote: > > No, that is also enabled by default on vanilla kernels, I just verified > on my machine running a vanilla kernel. It doesn't matter anyway, since > the permissions and ownership information is stored in the inode, not > the dentry so all hardlinks have exactly the same permissions. >
I don't believe you =P Check https://github.com/torvalds/linux/blob/master/fs/namei.c: int sysctl_protected_symlinks __read_mostly = 0; int sysctl_protected_hardlinks __read_mostly = 0; And compare with: https://gitweb.gentoo.org/proj/linux-patches.git/tree/1510_fs-enable-link-security-restrictions-by-default.patch?h=4.9 The fact that all permission and ownership information is shared is precisely the problem. When you change ownership of the hardlink (which you'll never know is a hardlink), you change ownership of /etc/shadow.