[TriLUG] fslint
Josh Vickery
josh at vickeryj.com
Thu Jan 10 07:29:11 EST 2008
On Jan 9, 2008 10:26 PM, David Black <dave at jamsoft.com> wrote:
> Until then, the hash-compare-delete-link utilities like fslint appear to be safe to use
> only on a single user's set of files, and then understanding all links
> to each de-duplicated file will share the same set of permissions bits.
I'm not sure about that. I think if you were to change the permission
on the inode to 644 (or 755 for executable) and change the user and
group to root, then it would be pretty safe. This would allow all
non-root users to delete the hardlink (to them it would just be a file
owned by root, strange) from their directory if they want. If then
want to change the contents of the file, it would take a bit more
work, but nothing horrible, especially if you explained what you did.
It's probably easier to illustrate than explain:
vickeryj at desktop:~/temp/link_test$ touch file1
vickeryj at desktop:~/temp/link_test$ ln file1 file2
vickeryj at desktop:~/temp/link_test$ /bin/su
desktop:/home/vickeryj/temp/link_test# chown root:root file1
desktop:/home/vickeryj/temp/link_test# mv file1 ~/
desktop:/home/vickeryj/temp/link_test# exit
vickeryj at desktop:~/temp/link_test$ ls -l
total 0
-rw-r--r-- 1 root root 0 Jan 10 07:19 file2
Hrmm, that's strange, can I edit this file?
vickeryj at desktop:~/temp/link_test$ vi file2
Hmm, vi told me I couldn't edit it, but it let me make changes anyway,
so I saved it to a new file.
vickeryj at desktop:~/temp/link_test$ ls -l
total 4
-rw-r--r-- 1 root root 0 Jan 10 07:19 file2
-rw-r--r-- 1 vickeryj vickeryj 5 Jan 10 07:19 file3
Well, who needs root's file?
vickeryj at desktop:~/temp/link_test$ rm file2
rm: remove write-protected regular empty file `file2'? y
vickeryj at desktop:~/temp/link_test$ ls -l
total 4
-rw-r--r-- 1 vickeryj vickeryj 5 Jan 10 07:19 file3
vickeryj at desktop:~/temp/link_test$ ls -l ~root/file1
Is that inode still around?
-rw-r--r-- 1 root root 0 Jan 10 07:19 /root/file1
Yup.
In explanation every user can delete their hard link, but no one
besides root can change the contents of that inode to which the hard
links point. If a user wants to change the contents they can create a
copy of their very own and then delete the hardlink. If enough users
make the same changes, you can re-run your dupe finding script.
Josh
More information about the TriLUG
mailing list