How to stop files moved to Linux from Windows via USB being marked "executable"?
Sorry about the long subject line but that pretty much summarizes the problem.
I'm finding this behavior increasingly annoying: When I move files from Windows to Linux using a USB drive, all files are marked as executable. Then double clicking on a ".txt" file gets you the ridiculous dialog box asking whether you want to display the file or execute it. (NOTE: The /etc/fstab entry for the USB mount includes the "noexec" option already and it hasn't helped.) Now that my wife and daughters are moving files back and forth between the two OSs, I'm getting pestered for a solution to this and I haven't been able to track anything down. Yet. What can one do -- presumably on the Windows side of the transfer -- to prevent these files from being marked executable? Or is it a hopeless problem caused by some dainbread decision made by a Windows developer? TIA -- Rick |
What filesystems are in use on all three ends (Linux source, USB stick, Windows destination)?
|
I get the same thing all the time. It happens (in my case) with an ext2 Linux filesystem and a USB stick with a windows format. The windows format filesystem does not have all the bits that the ext2 filesystem does, so when the files are copied the missing attribute bits have to be invented from somewhere.
The copy command supplies them from its defaults. That is as far as I have got. I usually do a "chmod a-x workdir/* " after I get irritated enough. Finding out what the copy command does to supply missing attributes would be difficult. It is likely not paying any attention to where the file comes from or else it presume that no windows file could possiblu be executable on Linux. Could use dostools to do the file copy, and see if it does better. Could make a script that does the copy and then removes the execute from all files. Off the top of my head (which means probably lots of errors): cp -a $(1) $(2) if [ -d $(2) ]; then chmod a-x $(2)/* else chmod a-x $(2) fi |
Quote:
Code:
cp -a $(1) $(2) |
Quote:
|
All times are GMT -5. The time now is 10:10 AM. |