How to make a script executable with chmod +x - Rocketeers app

  [ Rocketeers ](/)   

[Login](https://rocketeersapp.com/login) 

 On this page

 Knowledge
---------

How to make a script executable with chmod +x
=============================================

### [\#CommandLine](https://rocketeersapp.com/knowledge/command-line)

Fix the Permission denied error when running a shell script by adding the execute bit with chmod +x, plus the shebang line and chmod 755.

 Published by [Mark van Eijk](https://rocketeersapp.com/author/mark-van-eijk) on June 23, 2026 · 1 minute read

1. [Why a new script says "Permission denied"](#content-why-a-new-script-says-permission-denied)
2. [Add the execute bit with chmod +x](#content-add-the-execute-bit-with-chmod-x)
3. [Run the script](#content-run-the-script)
4. [Don't forget the shebang line](#content-dont-forget-the-shebang-line)
5. [The chmod 755 equivalent](#content-the-chmod-755-equivalent)
6. [When to use which](#content-when-to-use-which)

[\#](#content-why-a-new-script-says-permission-denied "Permalink")Why a new script says "Permission denied"
-----------------------------------------------------------------------------------------------------------

You write a script, try to run it, and Linux throws this at you:

 ```
$ ./deploy.sh
bash: ./deploy.sh: Permission denied

```

Nothing is wrong with your code. By default a freshly created file is readable and writable, but not *executable*. Linux refuses to run a file unless its execute permission bit is set, and that's exactly what's missing here.

[\#](#content-add-the-execute-bit-with-chmod-x "Permalink")Add the execute bit with chmod +x
--------------------------------------------------------------------------------------------

The fix is one command. `chmod` changes a file's mode, and `+x` adds the execute permission:

 ```
chmod +x deploy.sh

```

That `+x` grants execute to the user, group, and others at once (limited by your umask). Now Linux is allowed to run the file.

[\#](#content-run-the-script "Permalink")Run the script
-------------------------------------------------------

With the bit set, run it by giving its path:

 ```
./deploy.sh

```

The `./` matters. It tells the shell "the script is right here in the current directory". Without it, the shell only searches the directories in your `$PATH`, and your script almost certainly isn't in one of those.

[\#](#content-dont-forget-the-shebang-line "Permalink")Don't forget the shebang line
------------------------------------------------------------------------------------

The execute bit lets Linux *run* the file, but the file also needs to say *which interpreter* runs it. That's the job of the shebang, the very first line:

 ```
#!/bin/bash
echo "Deploying..."

```

`#!/bin/bash` tells the kernel to feed this file to Bash. For a more portable script you might use `#!/usr/bin/env bash`, which finds Bash via the `PATH`. Without a shebang, the script may run under whatever shell you happen to be in, which can bite you with subtle syntax differences.

[\#](#content-the-chmod-755-equivalent "Permalink")The chmod 755 equivalent
---------------------------------------------------------------------------

You'll often see numeric permissions instead of the `+x` shorthand:

 ```
chmod 755 deploy.sh

```

This sets read, write, and execute for the owner (`7`), and read plus execute for the group and everyone else (`5` and `5`). For most scripts `755` is the sensible default. If a script holds secrets and only you should run it, use `700` instead so the group and others get nothing.

[\#](#content-when-to-use-which "Permalink")When to use which
-------------------------------------------------------------

For a quick "just let me run this", `chmod +x` is all you need. When you want exact, predictable permissions, reach for the numeric form like `755`. If you want to really understand what those numbers mean and how owner, group, and other fit together, read my deeper guide on [changing file permissions with chmod](/change-file-permissions-chmod-linux).

### Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

  Fill in your email address to receive updates  Subscribe 

#### More in [\#CommandLine](https://rocketeersapp.com/knowledge/command-line)

- [Argument list too long (Bash: /bin/rm)](https://rocketeersapp.com/knowledge/argument-list-too-long)
- [How to install Composer packages locally](https://rocketeersapp.com/knowledge/install-composer-packages-locally)
- [How to send GET and POST requests with curl](https://rocketeersapp.com/knowledge/curl-post-get-api-requests)
- [Essential Linux command line basics for developers](https://rocketeersapp.com/knowledge/linux-command-line-basics)
- [How to search file contents with grep](https://rocketeersapp.com/knowledge/search-files-grep-command)
- [The complete guide to the curl command](https://rocketeersapp.com/knowledge/curl-command-complete-guide)

 [View all 21 articles →](https://rocketeersapp.com/knowledge/command-line)
