Score:1

Permission denied when running script, but correct file permissions and ownership are in place

jp flag

I am unable to run scripts that I previously had been doing:

$ SCRIPT.SH
bash: /media/USER/PATH/bin/SCRIPT.SH: Permission denied

Checking the file permissions and ownership, that are as expected:

$ ll PATH/bin
total 1
-rwxr--r-- 1 USER USER 1425 Aug  5 09:23 SCRIPT.SH

I have also tried running the scripts with sudo, and even given a test script full permissions:

chmod u=rwx,g=rwx,o=rwx SCRIPT.SH

Everything leads to the same bash: Permission denied message

Background: The scripts are located on a USB HDD, as they were when they could be run.
What has changed is: the drive label,
The updated .bashrc PATH entry for the 'new location'
PATH="/media/USER/MOUNTDIRECTORY/bin:$PATH"

And so the volume was mounted at the same 'named' place, an fstab entry
UUID=UUID /media/USER/MOUNTDIRECTORY ext4 defaults,user,auto 0 1

I'm clearly missing something!

Raffa avatar
jp flag
Unmount that filesystem and remove the mount option `user` as it implies `noexec` which will prevent binary executable e.g. `/bin/bash` from running on that virtual filesystem mount ... Then, mount it again and it should work..
Raffa avatar
jp flag
or alternatively, add the `exec` option after `user` like `defaults,user,exec,auto`
hr flag
... see for example [Why am I still unable to run a script on NTFS partitions after remount with suitable perssimions?](https://askubuntu.com/questions/780233/why-am-i-still-unable-to-run-a-script-on-ntfs-partitions-after-remount-with-suit)
Broadsworde avatar
jp flag
@Raffa, thank you so much, that seems to have worked nicely. A valuable lesson there, I knew I should have dug deeper into the fstab settings!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.