3

Trying to run a NZBGet (Python) Script, I've tried to run manually with:

/mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py

but this results in:

bash: /mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py: Permission denied

I've tried running this as sudo and SU and permissions are 777 currently, but still get the same message. How can permission be denied?

EDIT: It seems the partition is mounting with noexec, despite using the following:

/mnt/local/ext001 ext4 auto,rw,exec,async,user,suid,noatime,nodiratime,relatime 0 2

Any idea why it is not accepting the exec option?

  • When you're situated in ../videosort/ dir, could you run the script without problems? – tachomi Dec 22 '14 at 23:26
  • 5
    Every time you do chmod 777, somewhere in the world a kitten dies – janos Dec 23 '14 at 0:23
  • Is the partition mounted with noexec? – Mark Wagner Dec 23 '14 at 0:44
  • @janos I changed it to 777 to test it, surely if it is 777 it should be fine to execute with open permissions? – aSystemOverload Dec 25 '14 at 8:47
  • @MarkWagner no, it is exec: /mnt/local/ext001 ext4 auto,rw,exec,async,user,suid,noatime,nodiratime,relatime 0 2 – aSystemOverload Dec 25 '14 at 8:48
4

You're right that the order of the mount options is important here. From the man page:

   users  Allow every user to mount  and  unmount  the  filesystem.   This
          option  implies  the  options  noexec, nosuid, and nodev (unless
          overridden  by  subsequent  options,  as  in  the  option   line
          users,exec,dev,suid).

The exec option is before the users option, not subsequent to it, so the users option overrides it and sets the volume to noexec.

1

If python is executable and you don't want to remount partition (or can't), you can just run:

python /mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py

If you want to run a elf(linux binary executable file) file without the execute permission, you can:

/lib/ld-linux.so.* /path/to/elf/file

  • I'm sure this would have worked, but it did not fix the problem, not being able to execute the python script was just the symptom in this case. But thanks. – aSystemOverload Dec 26 '14 at 23:35
1

You need make your file executable.

chmod +x /mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py  

or

chmod 555 /mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py  

then, you can run that:

./mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py.
  • It was already executable, I was using incorrect placement of /etc/fstab mount options, this resulted in it being mounted as 'noexec'. Thanks for your input however. – aSystemOverload Dec 26 '14 at 23:35
  • what's the key difference between chmod +x and chmod 555? – Bjorks number one fan May 30 '18 at 17:35

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.