Changing permissions
D. Michael McIntyre
michael.mcintyre at rosegardenmusic.com
Sat Jul 21 15:57:27 UTC 2007
On Saturday 21 July 2007, Dotan Cohen wrote:
> You don't want to format that thing ext2/3. It won't be useable in
> WindBlows anymore, and thus the portability of the device is rather
> compromised. I suppose that you could tar files that you must keep
> permissions for.
You can do it if you never intend to use the stick with anything that isn't
Linux though. I expect. I haven't actually done it, but I used to format
floppies for Linux. It should work.
> Note that I think that it is unusual that the execute bit would be set
> on files from an insecure device such as a USB stick. I haven't
> checked what this machine, does, though. Can someone verify their
> machine's behaviour?
The execute bit is set on *everything* by default, because there are no
permissions in VFAT, and in order for the directories to be readable, they
have to be executable. Since there isn't any way to have fine-grained
control without per-file permissions (you have to set up *one* set of fake
permissions that are used for everything on the mounted VFAT filesystem)
there isn't really a good way around this problem. That's why the default is
usually to use 777 on everything.
If you've copied something from a VFAT source that's a 777 (rwxrwxrwx) mess,
you can probably fix it with something like this ($directory is the path to
whatever directory in question, like /home/foo/junk_I_copied_from_Winderz or
whatever):
find $directory -type f|xargs chmod 640
find $directory -type d|xargs chmod 750
(Or use 644 and 755. I keep more restrictive permissions than are the default
on most Linux systems.)
That will find all the files, then all the directories, respectively, and
reassign more appropriate permissions to them. That's probably sufficient
for most situations, I think, though I didn't actually set up a test scenario
and play with any of this for real. I could be spouting nonsense about this
777 thing, since it looks like none of the pictures I've copied off of my
memory cards have weird permissions. Oh well, if I go on record babbling a
torrent of bullshit because I think I'm such an all-knowing genius that I
don't have to bother fact checking before writing a treatise on a particular
subject, then it won't be the first time. At least I'm honest with myself,
eh? :D
--
D. Michael McIntyre
More information about the kubuntu-users
mailing list