1

So, i am trying to run a program i wrote in C, in my Samsung Galaxy Tab 2 (in a virtual machine)

it compiles without a problem, the make command runs smoothly but the program itself doesn't run

shell$ ./prot

This gives me the following error:

bash: ./prot: Permission Denied

These are the permissions on the file:

-rw-rw-r-- 1 root sdcard-rw 8609 Mar 20 16:23 prot

What could this be, and how can i overcome this little problem?

PS.: I'm using Ubuntu, this program compiles and runs well on my Mac.

EDIT: See the answer of teppic, it solved my problem.

2
  • You need the execute x permission. Commented Mar 20, 2013 at 16:32
  • Yeah, looks like you dont have X permission for anyone to execute Commented Mar 20, 2013 at 16:36

3 Answers 3

3

It's very likely that your sdcard is mounted with noexec, which prevents you from executing any files on it. If you look in /etc/fstab, and there's an entry for the sdcard, take out this option. It's also normally possible to remount with the exec option with mount -o remount,exec.

Otherwise, you may be able to copy it somewhere where executables are allowed (e.g. /tmp).

Sign up to request clarification or add additional context in comments.

1 Comment

And you were right! Thank you very much to you and the others that tried to help me!
1

You have to have permission for execution, i. e. the x bit set. Try

chmod +x prot

to fix it.

4 Comments

Tried that, the permissions didn't change, still the same error. Tried that command and also with sudo before it. Nothing.
@Souza Then you're missing something else. Are you sure you're chmodding the same file you're trying to run?
I think you need to chown and then chmod. I've also had chmod refuse the +x parameter but accept numerical ones like 777 on some systems.
seems the problem was that i didn't have the rights to change permissions at all inside the SD card, remounted with exec and it works now!
0

Maybe you need admin permission to change it, try:

$> sudo chmod 777 prot

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.