When I compile my C++ code on my Chromebook's shell, I get the error bash: ./a.out: Permission denied. This happens even when I run with sudo: sudo: unable to execute ./a.out: Permission denied. Why does this happen?

1 Answer 1


The problem ended up being that the filesystem was mounted with the noexec flag, probably for security reasons. To get around this,

  1. Run sudo mount -o remount,rw -o exec PATH/TO/YOUR/FILE, where PATH/TO/YOUR/FILE is the directory where you're trying to execute the file.
  2. If you get an error like mount: /home/chronos/user/Downloads not mounted or bad option, remove the last directory from the command (in this case /Downloads) and try again. Keep removing until it works.
  3. If you get an error like When remounting eCryptfs, you need to pass the mount utility the -i parameter to avoid calling the mount helper, run sudo mount -o remount,rw -io exec PATH/TO/YOUR/.

You should now be able to run the file.

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.