Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
Check your mount flags you are probably using the noexec mount option. – Ulrich Dangel Jun 25 '12 at 6:47
up vote 10 down vote accepted

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.)


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.


share|improve this answer
I couldn't get this as I am a newbie, would you mind elaborating more on In those cases, the umask is made up on the fly from a setting in the fstab ... I have to perform the same task as the OP. Thanks in Advance... – Am_I_Helpful Mar 13 '15 at 11:16
@shekharsuman: it means you cannot chmod files on a VFAT mount. All files on a VFAT mount have the same permissions, and what those are is set in the line for the device in /etc/fstab. (I have no idea where it is set if you use automounters.) – Ulrich Schwarz Mar 13 '15 at 11:59

It looks like your filesystem is mounted with the noexec option, which forbids executing programs on that filesystem by acting as if all execution bits in permissions were unset. If you use the user mount option (or if some user interface uses it under the hood), noexec is turned on unless you explicitly turn it off with exec.

Most USB sticks use the MSDOS-derived VFAT filesystem, which has no notion of permissions. You can only specify permission bits when you mount the filesystem, and these permissions apply to all the files on that filesystem.

If you don't have permission to execute a script, call the interpreter explicitly:

sh /media/stick/test.sh

For a dynamically linked binary, invoke the dynamic linker.

/lib/ld-linux.so.2 /media/stick/myprog
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.