File Permissions – How to Change File Permissions on USB Drive

executablepermissionsusb-drive

Whenever I create or copy few shell files to usb storage device, then I am not able to make them executable.

If I create test.sh, it's default file permission will be 644, but when I execute

chmod 777 test.sh

no error reports and echo $? also returns "0". But still ls -l shows permission as 644 and I can not execute it as ./test.sh

Best Answer

Yes, this can occur if your device is formatted with a filesystem that does not support that kind of permission setting, such as VFAT. In those cases, the umask is made up on the fly from a setting in the fstab (or the hotplugging equivalent).

See, most probably, man mount for details. For example, for VFAT, we find:

Mount options for fat

uid=value and gid=value

Set the owner and group of all files. (Default: the uid and gid of the current process.)

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.

etc.

Related Question