Script executable gets permission to use Linux

trying to run a script in Ubuntu 14.04.

$ bash MirroirHome

works great

but

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

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

I own the file and the enable bit is enabled, what happens?

In this case, the script matters.

#!/bin/bash
rsync \
--archive \
--verbose \
--compress \
--update \
--delete \
/home/ /media/Data/MirroirHome
+4
source share
1 answer

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

To solve this problem, unmount the partition without a flag noexec. Or copy the script to another section that is already installed without noexec.

+3
source

Source: https://habr.com/ru/post/1615912/


All Articles