Re: removing execute permissions from a USB file
Hi,
On Sat, Nov 29, 2025 at 09:31:52PM -0500, Lee wrote:
> I feel like I'm missing something really basic, but I copied a bunch
> of files off my Windows 10 machine to a USB drive. I'm trying to copy
> some of those files to my Debian laptop & noticed all the files have
> execute permissions .. which is no big deal but they're MP3 files
> which aren't programs so it seems like they shouldn't have executable
> file permission set. But how do I turn it off???
I assume since you say this USB drive came from a Windows machine that
it is formatted with a Windows filesystem like vfat or similar. Since
Windows and its filesystems don';t support Unix file permissions, when
mounted on Linux a default set of permissions is assigned to every file
and directory present.
You can see what your options are by looking at the man page for the
"mount" command and then finding the "Mount options for fat" section:
umask=value
Set the umask (the bitmask of the permissions that are _not_
present). The default is the umask of the current process. The
value is given in octal.
(See also "dmask" and "fmask", because you definitely will need execute
permissions for directories so they can be searched.)
So, I think you'd want to set that to something like 177 to leave 600
for user, group and other, which would correspond to read+write, nothing
and nothing respectively.
These options would go in the /etc/fstab line for the relevant
device/filesystem but of course this is a removable device so you
probably don't have a line in fstab for it and are relying on your
desktop environment to mount it for you.
Usually this is done by the udisks2 package which takes care of
mounting removable media under /media/$USER/… so the question becomes
how to influence its choice of mount options.
I have never tried but it looks like this could be changed in
/etc/udisks2/mount_options.conf - see the file at
/etc/udisks2/mount_options.conf and also:
https://storaged.org/doc/udisks2-api/latest/mount_options.html
Thanks,
Andy
--
https://bitfolk.com/ -- No-nonsense VPS hosting
Reply to: