Permission Denied While Running Shell Script [Complete Solution]

Here is How to Fix Permission Denied Error while running shell or .sh scripts on your Linux or Ubuntu System. The error code such as program exited with code: 126 can appear while trying to execute the code.

Why do permission denied error occurs?

You can read this article on 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

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top