Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executable script gets permission denied on Linux box

trying to run a script on Ubuntu 14.04.

$ bash MirroirHome

runs fine

but

$ ./MirroirHome
bash: ./MirroirHome: Permission denied

$ ls -l
total 32
-rwxr-xr-x 1 gerald gerald  214 nov 14 15:44 MirroirHome

I am the owner of the file and the permission bit is on, what is going on??

Here is the script in case it matters.

#!/bin/bash
rsync \
--archive \
--verbose \
--compress \
--update \
--delete \
/home/ /media/Data/MirroirHome
like image 271
user3515714 Avatar asked Oct 18 '22 22:10

user3515714


1 Answers

This can happen if the partition is mounted with the noexec flag on. You can verify this by running mount: find the partition in the output, and in the list of flags, probably there will be noexec.

To resolve this, remount the partition without the noexec flag. Or, copy the script to another partition that's already mounted without noexec.

like image 95
janos Avatar answered Oct 22 '22 01:10

janos