0
cd /media/k4li/data2/C
gcc program.c
./a.out

running ./a.out:

bash: ./a.out: Permission denied

if I enter sudo ./a.out i get:

 sudo: ./a.out: command not found
Kali
  • 1

2 Answers2

1

Because NTFS doesn't store or use "Linux" file permissions the kernel emulates them. You set the entire mount partitions permissions at mount time. You have two option.

  1. Remount the NTFS partition, setting the permissions to something less restrictive. This is the least secure option.

  2. Move the executable to your Linux partition, then chmod it, then run it. There are more steps here but this is the most secure option.

2 is more secure then 1 because you only change the permissions of one file, not the entire partition.

coteyr
  • 18,288
0

You need to set a.out's permissions to executable - use:

sudo chmod +x a.out

And then try running it again.

Edit: Need to use sudo on chmod.

Mark Kirby
  • 18,529
  • 19
  • 78
  • 114