Software⏱️ 2 min read📅 2026-05-31

How to Fix: Permission denied when running .sh scripts

Permission denied when running .sh scripts: Check file permissions and execute with correct privileges.

Quick Answer: Check the file permissions for your script and run it with sudo or the correct user's privileges.

The 'Permission denied' error when running .sh scripts is a common issue that can be frustrating to resolve. This problem occurs when the script is trying to execute a command or access a file that it does not have permission to do so.

🔍 Why This Happens

  • [Cause]

🚀 How to Resolve This Issue

Method 1: Change Ownership and Permissions

  1. Step 1: Open a terminal and navigate to the directory where your script is located using the `cd` command.

Method 2: Use `chmod` Command

  1. Step 1: Open a terminal and navigate to the directory where your script is located using the `cd` command.

🎯 Final Words

To avoid this issue in the future, make sure to run your scripts with the correct permissions. Additionally, consider using `sudo` or `su` commands when executing scripts that require elevated privileges.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions