Executable script gets permission denied on Linux box

橙三吉。 提交于 2019-12-23 09:55:49

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/33713244/executable-script-gets-permission-denied-on-linux-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!