Usually, you get the error bash permission denied when running some script/file that does not have execute permissions. All you need to do is to change file permissions and add executive one. To do this run the CLI command:
chmod +x path_to_file/file_name
For example, if you run a Magento 2 CLI command:
and get the error:
bash: bin/magento: Permission denied
You'll need to add an execute (x) permission to the bin/magento file.
For this, please run the CLI command:
chmod +x bin/magento
In case of Magento 2 you can also use the next command to avoid the issue (php before bin/magento):
php bin/magento ...