Souza
Souza

Reputation: 1143

Can't run program after compilation with gcc

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.

Upvotes: 1

Views: 1035

Answers (3)

teppic
teppic

Reputation: 8195

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).

Upvotes: 3

FELIPE_RIBAS
FELIPE_RIBAS

Reputation: 411

Maybe you need admin permission to change it, try:

$> sudo chmod 777 prot

Upvotes: 0

user529758
user529758

Reputation:

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

chmod +x prot

to fix it.

Upvotes: 1

Related Questions