1

I have a python script, in which I have the following shebang #!/usr/bin/python the script permissions are -rwxrwxrwx. 1 user user 709 script.py the owner of the script is the same as the user I use to run the script.

I do not understand why I get Permission denied when I run ./script.py but I can run it with python script.py or /usr/bin/python script.py. What I am missing?

Linux distribution is RedHat 6

5
  • 1
    Which distribution are you using? E.g. on Fedora it could theoretically be a SELinux issue.
    – sourcejedi
    Jul 31, 2019 at 21:50
  • 7
    vol mounted with noexec ?
    – steve
    Jul 31, 2019 at 21:56
  • I was having this same issue until I made the file executable. Are you 100% sure that you have the executable bit on? chmod u+x script.py
    – Gordster
    Jul 31, 2019 at 22:03
  • you could try using strace -f on the shell, then try to run the script, and see where you get the error
    – mmusante
    Aug 1, 2019 at 1:03
  • 1
    @steve you are right /dev/mapper/systemvg-home on /home type ext4 (rw,noexec,nosuid,nodev). Thank you.
    – dejanualex
    Aug 1, 2019 at 6:33

1 Answer 1

3

The file-system where the script resides was mounted with 'NOEXEC' flag /dev/mapper/systemvg-home on /home type ext4 (rw,noexec,nosuid,nodev)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .