Which permissions affect hard link creation? Does file ownership itself matter?
alice wants to create a hard link to the file
target.txt in a directory
- Which permissions does
aliceneed on both
target.txtis owned by user
target-diris owned by user
chad, does that change anything?
I've tried to simulate this situation by creating the following folder/file structure on an
#> ls -lh . * .: drwxr-xr-x 2 bill bill 60 Oct 1 11:29 source-dir drwxrwxrwx 2 chad chad 60 Oct 1 11:40 target-dir source-dir: -r--r--r-- 1 bill bill 0 Oct 1 11:29 target.txt target-dir: -rw-rw-r-- 1 alice alice 0 Oct 1 11:40 dummy
alice can create a soft link to
target.txt, she can't create a hard link:
#> ln source-dir/target.txt target-dir/ ln: failed to create hard link ‘target-dir/target.txt’ => ‘source-dir/target.txt’: Operation not permitted
target.txt and no permissions are changed, the hard link succeeds. What am I missing here?