Fix Permission Denied while Executing Bash (Shell) Script on Linux
If you encounter an error like
bash: ./script.sh: Permission denied when executing bash (shell) script, meaning the script file itself is not permitted to execute. And make no difference even if you run it with
sudo. To fix this, we'll be using
chmod command on Linux to modify the permissions.
chmod to add executable permission to the file:
sudo chmod +x script.sh Bash
script.shto your script's path.
Or use your preferred file manager to change the permissions of the script file: