DragonFly BSD
DragonFly users List (threaded) for 2012-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Hammer Hardlinks (permission question)


From: "sad@xxxxxxxxx" <sad@xxxxxxxxx>
Date: Sat, 25 Aug 2012 15:09:17 +0400

Hello, all

i have encountered a bit unexpected and counter-intuitive behaviour of ln
and wonder if it is OK:
to require _write_ permission on the _source_ file while creating a 
hardlink to.

here is a shell session:

$ ls -l

drwxr-xr-x  1 sad  sad    - 0 Aug 25 14:48 dir1/
drwxrwxr-x  1 sad  emilk  - 0 Aug 25 14:50 dir2/

dir2 is supposed to be written by user emilk and is empty


$ ls -l dir1

-rw-r--r--  2 sad  emilk  - 6 Aug 25 14:45 file1


now switch to the user "emilk" and try to create a hardlink

$ su emilk
$ ln dir1/file1 dir2/file1

ln: ./dir2/file1: Permission denied


now change the singe perm

$ sudo chmod g+w dir1/file1
$ ls -l dir1

-rw-rw-r--  2 sad  emilk  - 6 Aug 25 14:45 file1


$ su emilk
$ ln dir1/file1 dir2/file1
$ ls -l dir2

-rw-rw-r--  2 sad  emilk  - 6 Aug 25 14:45 file1

It worked.
And it is confusing, since actually i have only written to dir2, keeping 
the _source_ file INTACT.


Any comments?
thnx.



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