I had a C program and made it executable on my 32 linux mint. For assignment purposes I had to test if it was working on university pool computers. I honestly don't know which linux distributions are installed there, just had two minutes didn't really take a look but I know that it's also 32 bit system.

So when I tried to run it in terminal (./program), I got bash permission denied error, which I know means that the file is not executable So I ran chmod u+x program command again to make it executable and then it worked, my program was working just fine as on my laptop.

Does anybody know what can be the reason for that? I mean, obviously, my file is executable, at least on my linux mint, what can be the reason that it is not on some other linux distribution?

Maybe I have to make it executable in another way? I only know the one mentioned earlier chmod u+x program.


as mentioned in the comments the way I transfered my file to university computer was: download it from google drive. Now I tested on my laptop but to another system (UBUNTU), I tried again downloading from google drive the single file and the problem was same: not executable. Then I tar-ed the file (as Richard suggested) and after extracting it file was executable right away, so this leads me to conclusion that if I tar it, it should also be executable to any other system , in this case my university computer.

  • 2
    How did you transfer the file from your laptop to the university computer? – Timothy Martin Jan 19 '17 at 18:20
  • @TimothyMartin I had it uploaded on my google drive and downloaded from there on university computer – Leonardo Jan 19 '17 at 18:21

Because you had not done chmod u+x, non unix files systems will not store this data, it is outside of the file: the execute bit was not copied to google-drive. Therefore you had to run chmod again.

On the machine that you compiled it you did not have to run chmod, as the compiler does this for you.

As long as you keep it within the Unix eco-system, the x bit will remain. However google-drive is not Unix (though it runs on Unix). tar is a program that can wrap us a load of files/directories into a single file, along with all of there meta-data.

  • I am not sure I follow, you are saying that instead of chmod u+x, I have to do chmod +x and it will work? – Leonardo Jan 19 '17 at 18:29
  • no the u or lack of it is not relevant, I updated the answer, to avoid confusion. – ctrl-alt-delor Jan 19 '17 at 18:40
  • But, I did chmod u+x – Leonardo Jan 19 '17 at 18:43
  • Yes as you said in the question “so I ran chmod u+x program command again to make it executable and then it worked” (emphasis mine). – ctrl-alt-delor Jan 19 '17 at 18:44
  • aha, okay, so you mean that because I had not done it on university computer that's why it did not. Okay, now my question is, what should I do so that I will not have to run chmod u+x on university computer? where is the executable bit and how can I conclude it with my file? – Leonardo Jan 19 '17 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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