0

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??

3 Answers3

1

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.

Optichip
  • 121
0

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

mbs
  • 672
0

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.