./geany_run_script.sh: 5: ./geany_run_script.sh: ./Area_circumference: Permission denied

program exited with code: 126. This problem always occur when I try to execute my code. What might be the solution?

  • 1
    Permission denied error are occurs only if you don't have enough privilege to access that file. Jan 22, 2014 at 6:47
  • How can I change the permissions
    – khwilo
    Jan 22, 2014 at 7:01
  • Where do I do that please give me a shot example
    – khwilo
    Jan 22, 2014 at 8:01
  • When I do that it tells me this chmod: cannot access `geany_run_script.sh': No such file or directory. Should I run it from the terminal or what?
    – khwilo
    Jan 22, 2014 at 8:13
  • possible duplicate of How do I run .sh files in Terminal? Aug 6, 2014 at 5:23

4 Answers 4


Here's a link which explains about Changing file permission (and ownership)

If you want to skip these (for now of course), you can create a directory/folder in your user-home directory and work on your C programmes (or others) there.

You can open the terminal (press Ctrl + Alt + T) and cd to the target directory:

cd /path/to/target

To give the file "the_file_name" execute permission (if the file-system allows you with the RW rights):

chmod +x the_file_name
  • How can I change the permissions any examples
    – khwilo
    Jan 22, 2014 at 7:56
  • The problem how can I do that?I am a new Ubuntu user I recently switched from windows.
    – khwilo
    Jan 22, 2014 at 8:15
  • ..what's your working directory ie. what's the location of your source code file? ..do you have some experience with windows CLI?
    – precise
    Jan 22, 2014 at 8:50
  • @wkhwilo-012, see if that helps and please don't hesitate to ask more..
    – precise
    Jan 22, 2014 at 9:34
  • @wkhwilo-012, please copy your executable file Area_circumference and paste it (the file path will be pasted) to update your question's body...
    – precise
    Jan 22, 2014 at 9:46

You need to give execute and read permissions. Follow this:

chmod u+r+x filename.sh


When we make a new script file then by default it has read and write permission. But if we want to execute them, then we should give execute permission as shown above.

Execution bit alone is not enough for shell scripts, one must be able to read the file as well to execute it (contrary to binaries which only need the execute permission bit)

  • 2
    u (user) +rx (add read and execute permissions) Jan 9, 2020 at 10:06
  • 1
    Indeed, the second plus may be omitted - u+rx.
    – Artfaith
    May 24 at 0:56

Open your terminal application by pressing CTRL + ALT + T or with the apposite shortcut on the graphical enviroment (like Terminal or xTerm).
In the uniform window which appears on the screen you'll see a blinking character, it's the terminal cursor: simply click on the window and write to enter text (typically commands) and press ENTER to confirm the input.
Before the cursor there is always listed your current position on the file system from the root directory ("/") and your home (where your personal files are) is called "~".
To change directory/folder use cd EXISTENTFOLDER (replace EXISTENTFOLDER with the folder name); if you feel lost, simply type cd to return to your home directory in a blink!
Now let's solve your problem:

  1. Use the cd command to find the directory with your source code. Use TAB to help you. If you execute ls -lh, you'll see a list of possible paths to follow and files to execute.

  2. When you've find the blocked file execute chmod +x FILENAME (replace FILENAME with the name of your source code file).

  3. If you have multiple blocked files execute chmod +x * to unlock all files in the current directory. Never chmod +x dangerous or insecure files.

  4. Execute ./FILENAME YOUREVENTUALARGUMENTS to execute your executable file.

  5. Remember that if your compiled program tries to read/write outside your home directory you'll need to execute it as root by using sudo ./FILENAME YOUREVENTUALARGUMENTS.

If you want to have a manual for a command execute man COMMAND (replace COMMAND with the exact command name, Linux is case sensitive).

Some shells have an Open terminal here command to simplify your life, search for it in the future and remember that the command shell can be your best friend, if you use it well. :-D

It's all. If you need more help comment under here.
If I'm helping you press the UP arrow on the left; if you solve mark this answer as best answer.

Have a nice experience on Linux & Ubuntu.

  • Thanks a lot. Now I can work under the home directory. The operation you asked me earlier cannot be permitted. It says I have no permission but thanks anyway for the suggestion.
    – khwilo
    Jan 22, 2014 at 13:41

Or you can excute it with your shell directly(or other shell versions), if you don't want to change the permission.

$ bash filename.sh

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.