Re: DFQs - files, filesystems



Jim Backus wrote:

So I've got a PC running Linux and am trying man-fully :-) to learn my
way round the CLI. I figure that a fair grounding in the CLI can only be good. I've read pages of man files, info pages etc, but still feel I'm not so much as the bottom of a steep learning curve as at the bottom of The Old Man of Hoy with the tide rising.

A couple of DFQs* for now:

In OS/2 or DOS, when a file has the attributes set to 'read', a file cannot be deleted at the command line without first using 'Attrib -r'.
I was surprised to see that the Linux equivalent of Del (rm) allows a file with the 'w' bit off to be deleted. i.e.

create file 'testfile'
chmod u-w testfile
rm -i testfile

Sure I see a message asking if I want to delete a write protected file, but what if I'd not specified -i? Would it have deleted the file
anyway? How should a file be protected from accidental deletion?

Hint: "deleting" a file requires the system update or "write" to the directory. If you don't have write access to the directory you can't delete anything. The same applies to renaming files---it's just another write operation on the directory information.

As an aside I discovered that copying a file owned by someone else gives me ownership of the copied file. Probably reasonable, but slightly surprising.

Why is it surprising? Think about what would happen if copying a file preserved ownership and the filesystem had quotas enabled. If "Joe" could read a file owned by "Bob" and any new copies were also owned by "Bob", then "Joe" could use up all of "Bob's" quota and none of his own.

On filesystems

The old PC that I'm using has 2 hard drives. The first, hda, has two partitions, one for swap and one (ext3) for everything else. The second drive is still formatted with FAT32. It is not mounted automatically, but I can mount it, see a couple of files and directories, and umount it. However the fsck does not support FAT32. What would I have to do to get that?

There is a dosfsck (aka fsck.msdos). On Debian this is part of the dosfstools package.

[snip]
Presumably if I wanted to mount hdb at boot time I should modify fstab? Is there a preferred tool for doing this or is it just a case of editing the file?

Edit the file by hand.
.