0

So I have a particular ext4 drive that doesn't allow me to execute files. I have the following example in bash where even with sudo and with the file having execute permissions for all users, the file does not execute. If I move the file to an alternate partition, it works fine. Thoughts?

$ ./pycharm.sh
bash: ./pycharm.sh: Permission denied
$ sudo ./pycharm.sh
sudo: unable to execute ./pycharm.sh: Permission denied
$ sudo -s
# ./pycharm.sh
bash: ./pycharm.sh: Permission denied
# lsattr pycharm.sh
-------------e-- pycharm.sh
# ls -la pycharm.sh 
-rwxr-xr-x 1 me me 5908 Nov 20 03:18 pycharm.sh
9
  • The mount options on linux default to rw, suid, dev, exec, auto, nouser, async, and relatime. However it is possible to mount witht he reverse, e.g. 'noauto' for optical drives. Please check if your volume is not mounted with no-exec. – Hennes Apr 11 '15 at 11:46
  • @Hennes all my other drives don't have exec or noexec (must exec automatically) and they work. This drive doesn't and uses the same config: ext4 users,relatime,errors=remount-ro 0 1 – Peter Apr 11 '15 at 11:59
  • Yup. The default (if not specified) is exec. However it was worth checking for either this or for ACLs. – Hennes Apr 11 '15 at 12:01
  • No ACLs present. The same thing happens to unrelated executables. – Peter Apr 11 '15 at 12:49
  • Does anything appear in logs (/var/log/messages, /var/log/secure) when you try to run the script? – Paul Haldane Apr 11 '15 at 13:08
1

Maybe you have set your fstab options to prevent execution on this filesystem?

Have a look at /etc/fstab, maybe you've set the noexec option.

2
  • It doesn't appear so. They are the same as my other partitions: ext4 users,relatime,errors=remount-ro 0 1 – Peter Apr 11 '15 at 11:58
  • What does the 'mount' command say? Perhaps there are errors that are forcing it to re-mount with restrictive options? – artifex Apr 11 '15 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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