I have a storage drive I normally mount just clicking on the disc in the file browser. However, I want to be able to run some bash scripts from that drive. When I try ./script.sh
I get Permission Denied. How can I set it up so I can run scripts from this drive?
Asked
Active
Viewed 4.4k times
9

Nathan Schwermann
- 2,187
-
What filesystem is used on the drive in question? – dobey Jan 22 '13 at 21:10
-
@dobey I'm pretty sure its NTFS – Nathan Schwermann Jan 22 '13 at 21:18
1 Answers
13
Work Around
There is a simple work around, instead of ./script.sh
, do
sh script.sh
Or
bash script.sh
You should check the first line of script.sh to confirm which shell to use.
Manual Mount
Mount with command line, you can use the exec
option as follow
mount -o exec <device> <mount-point/path>
mount -o exec /dev/cdrom /mnt/cdrom
If the disc is automounted, you will have to un-mount(not eject) it with file manager first.
udisk
This is the complicated way and is answered in this post.
-
No good, the script also tries to call other scripts and stuff getting permission denied. – Nathan Schwermann Jan 22 '13 at 21:20
-
1
-
How do I know my arguments, usually the drive is called /media/Media not sure where to get the equivilent of /dev/cdrom /mnt/cdrom – Nathan Schwermann Jan 23 '13 at 06:21
-
To check your cdrom/dvdrom dev path, put in a disc, wait for it to automount, then in a terminal type "mount", it should show up in the list. Possibiliteis:
/dev/sr0
– John Siu Jan 23 '13 at 06:27 -
1The second arguments is actually just any empty folder you created beforehand. Common ones to use are
/mnt/cdrom
,/media/cdrom
– John Siu Jan 23 '13 at 06:28 -
@JohnSiu, does someone need to unmount the USB that has the files before mounting again to the new mount point? can they leave the automounted point mounted and mount to a new point? I do this and for some reason files still lack the executable permissions option. – Vass Jul 31 '22 at 18:35