Why doesn't chmod work on a file under /media?
I want to execute a script file from terminal but it shows error
root@silambarasan-PC:/media/D-DEVELOPME/androidSdk/adt-bundle-linux-x86/sdk/tools# ./android
-bash: ./android: Permission denied`
so I saw the file permissions from terminal & tried to give execute permission. but no use even I give permission it won't change.
root@silambarasan-PC:/media/D-DEVELOPME/androidSdk/adt-bundle-linux-x86/sdk/tools# ll android
-rw-r--r-- 1 silambarasan silambarasan 3498 Dec 6 08:14 android
root@silambarasan-PC:/media/D-DEVELOPME/androidSdk/adt-bundle-linux-x86/sdk/tools# chmod 777 android
root@silambarasan-PC:/media/D-DEVELOPME/androidSdk/adt-bundle-linux-x86/sdk/tools# ll android
-rw-r--r-- 1 silambarasan silambarasan 3498 Dec 6 08:14 android`
I don't know what to do.
Thank you.
Solution 1:
Easiest would be to copy the executable to your home folder and start it from there.
But…
It seems your executable is mounted on an external partition. Make sure the partition is not mounted with noexec
. Try:
grep '/media/D-DEVELOPME' /etc/mtab | grep noexec
If you see a line containing the word "noexec", try re-mounting the partition without the noexec
flag:
mount -o remount,exec /media/D-DEVELOPME
Also make sure your media actually allows you to change the permissions, e.g. you cannot do that on a mounted CD or an SD crad with the read-only switch on.