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

Re: Hardlinks



On Thursday 03 March 2005 16:53, Tong wrote:

> My understanding is that hard-links are not reliable. If I modify any of
> the hard links, most probably, the linkage would be broken. Is that so?

Modify in what way?

OK, here's the deal.  A hard link is like an arrow that points to the 
contents of a file.  In fact, when you delete a file, you're actually 
removing the link from that filename to the file contents it represents - 
when that "link count" reaches zero, the filesystem generally frees up the 
space it was occupying.  So, if "A" points to a file, and you make "B" a 
hard link to "A", what you've *really* done is created a second pointer to 
that file.  If you then delete "A", the result is exactly as if you'd just 
created the file with the name "B" in the first place.  There's no real 
concept of the "original" file name.

> I.e, when I am hard-linking /etc/passwd, /etc/shadow and /etc/group into
> a chroot environment, Should I keep doing the hard-linking to keep then
> in sync?

What do you mean by "keep doing the hard-linking"?

The real question is why you're making the whole contents of /etc/shadow 
available inside the chroot.  If the chrooted services gets compromised, 
then you've just given the attacker all of your passwords.  Are you sure 
that's what you wanted to do?
-- 
Kirk Strauser

Attachment: pgpfTg3fzeFQ9.pgp
Description: PGP signature


Reply to: