Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
.exe file permission fail

I wrote a simple hello world program but not stored it in Ubuntu's home directory, instead I stored it on one of the Windows drives. (I am using Ubuntu 12.04 alongside of Windows.)

When I compiled the program it worked just fine but when I tried to execute it I got an error message "Permission denied".

And When I store the program in Ubuntu's home directory I can perfectly compile and execute the program. So please tell me how to overcome this problem??

share|improve this question

marked as duplicate by lgarzo, roadmr, Thomas W., jrg Jun 25 '12 at 12:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers 3

When you mount the windows partition in Ubuntu it mounts with with a noexec directive. You could just mount that drive in your fstab if you access it from Ubuntu a lot. You will need to run a blkid to determine what the UUID of the Windows drive is, then add a mount statement for it in your fstab. Make sure when you get to the arguments section of the line that you don't specify noexec.

share|improve this answer

First you should check the permissions on the file and the filesystem

 ls -la <filename>

Check if you have the appropriate rights to execute the file

Or check what the filesystem properties are for the mounted windows filesystem

mount

Paste the output here. Perhaps we can help

share|improve this answer

You need to change to that directory and then run the program after changing permissions. You will become a super user for this purpose.

I am assuming that you can navigate to that directory in Windows where you saved that file.

Now, go to that directory and open terminal on the other side and type

cd

and drag the directory in which your .c file exists into the terminal. If your file is in Windows Desktop, the terminal will look like this:

cd '/media/Windows_7/Users/username/Desktop' 

Now, let's say your file is test.c, change the permissions of the file and see whether it works using this:

sudo chmod 755 test.c

Now compile and see whether it works, if not do the same for a.out too.

If that didn't work, I guess it means that the drive permissions need to be changed.

For that the command would look something like this:

sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0000 /dev/whatever /mnt/whatever

where 'whatever' depends on your system.

The instructions for doing that are here and here

If that's not what you are talking about, then you should do what mbs said.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.