0

I have a file that I compiled to an executable but when I attempt to run it with ./main, it says permission denied. I used to have no problem executing files from this drive. I have deleted the file and recompiled it. If I run ls -la I see that root owns it and it has executable permissions.

I attempt to run it with sudo ./main and for some reason permission is still denied.

The partition is NTFS because I share it with my Windows partition.

I tried running a basic game executable that I made in Unity game engine. It ran with no issues. There only seems to be a problem with this file.

EDIT:

Thanks to one of the commenters for giving me this link: How do I use 'chmod' on an NTFS (or FAT32) partition? I added the exec option, and I was able to run my program. I did not check in with this problem earlier because it resolved itself temporarily for some unknown reason. It came back, so I was glad I had these responses to help me. Thanks!

  • 2
    So "this" file doesn't run, but "that" file does? Is this the question? – Pilot6 Feb 02 '23 at 15:06
  • 1
    It is rather common, that Linux mounts Microsoft file systems without execute permissions for files located there [for security reasons]. This can be modified, see Example 2 at this link. – sudodus Feb 02 '23 at 16:13
  • 1
    The file that does work, is it on your Linux partition or your NTFS partition? Refer to sudodus' comment for the reason I ask this – Thomas Ward Feb 02 '23 at 16:14

0 Answers0