I've managed to reproduce the problem on Fedora 20. It indeed is a kernel thing having to do with security. Not only can 'cp' not create hardlinks to symlinks; it also can't create hardlinks to regular files. The problem affects all applications, e.g., 'ln'.

Not much that coreutils can do about it, as far as I can see, as it's a kernel issue.

You can work around the problem by running 'cp' (or 'ln' etc.) as root.

Here's an example, where I am running as a regular (non-root) user that is not in the 'root' group:

$ find dir/a -ls
5300828    0 drwxrwxr-x   2 root     root           80 Mar 26 16:50 dir/a
5338695 4 -rw-r--r-- 1 root root 5 Mar 26 16:50 dir/a/data 5300831 0 lrwxrwxrwx 1 root root 9 Mar 26 11:20 dir/a/symfile -> ../b/file
$ mkdir d
$ ln dir/a/data d
ln: failed to create hard link ‘d/data’ => ‘dir/a/data’: Operation not permitted
$ ln dir/a/symfile d
ln: failed to create hard link ‘d/symfile’ => ‘dir/a/symfile’: Operation not permitted




Reply via email to