How to Solve Permission Denied Error in Linux

How to Solve Permission Denied Error in Linux

Privacy is Linux’s no 1 concern. Since the permissions of the user and group Linux files and directories work independently, being allowed to open a file does not necessarily mean that you can edit it. Solve Permission Denied Error in Linux is what you will learn in this article to get skilled in what to do when facing this common error. To work with a Linux operating system properly, you need to know that running commands requires permissions (Read, Write, or Execute).

Privileges of files and directories are associated with them and the system does not allow you to access the files and directories if you are not authorized. That’s when the ”permission denied” error will occur. Join us with this article to see how this error can be solved by getting access to the files and directories.

Prerequisites to Solve Permission Denied Error in Linux

To let this tutorial works correctly, provide the options below and move on.

  • A Server running Linux VPS.
  • A non-root user with sudo privileges.

What is Permission Denied Error & Why Linux Users Face It?

As you may know, the ‘’root’’ in Linux has complete access to all directories and files to do any required changes. In this way, other users are not permitted to do all the actions that the ‘’root’’ is.

Linux systems have three different permission categories: read permission, write permission, and execute permission. The user and group permissions associated with each file and directory in the Linux file system determine who has access to read, write, and execute the file. When you get the Permission Denied issue on a Linux system, it typically signifies that the file or directory you are attempting to interact with does not belong to your user account.

It is not that complicated to solve Permission Denied Error in Linux. Follow the required instructions in this tutorial to check file and directory privileges.

Quick Solutions to Fix Permission Denied Error in Linux

As a Linux user, you might face the ”permission denied” error while working on your Linux files and directories. While executing a shell script without having sufficient permissions on the user account, the ”permission denied” error occurs, and you just need to have permission to execute this script.

Let’s go through this tutorial and review all the useful methods to Solve Permission Denied Error in Linux.

Solution 1. Check Privileges of a Particular File/Directory

To view the owner, group, and permission information of all files and directories, you can check the current permissions on them. To view which files and folders have permissions, run:

$ ls -l Shell Script

The output displays if the owner, group, and users have read, write, and execute permissions on the files or not.

  • r specifies the read permissions.
  • w specifies the write permissions.
  • x specifies the execute permissions.

Solution 2. Add Required Permissions

Now that you noticed what permissions you do not have on your user account, it is time to add the proper permissions you need. Previously, you learned about the chmod command in Comprehensive Linux Commands. Here, you can use the chmod command to achieve the purpose of this technique.

To add read permissions, run:

$ chmod +r Shell Script

To add write permissions, run:

$ chmod +w Shell Script

To add execute permissions, run:

$ chmod +x Shell Script

Also, you can add all the permissions at a time if you have no one of them:

$ chmod +rwx Shell Script

Solution 3. Take Ownership of the File in Linux

If required, you can obtain more permissions than other users. However, you will be able to edit the permission when you need it. For example, using the chown command, you can change the owner of the file to user operavps:

$ chown operavps Shell Script

Solution 4. Read, Edit, or Execute a File

To read, edit, or execute a system file, you can change file permissions or use the root account in linux ubuntu. The second way is more recommended. A system file or application configuration file’s file permissions can be changed, although doing so may have unfavorable consequences. So, to edit a file, run:

$ sudo nano /path/to/config

Also, you can use the following Linux command to open, edit, or execute the file you required rights for while logged in as the root account:

$ su -
# nano /path/to/config

Solution 5. Change The Permissions on Directories in Linux

You are so close to finishing learning the main ways to solve permission denied error in Linux. You can use the command below to change the permissions on directories. To do this, run:

$ chmod +w /path/to/dir

Alternatively, you may use the -R argument to your command to recursively change the permissions on all files:

$ chmod -R +w /path/to/dir

Solution 6. Using Absolute Mode

The rwx permissions are called symbolic mode. You can use absolute mode which represents the permissions by octal numbers. So, you can grant all read, write, and execute permission to the owner of the file and read permissions to all other users by running a command like below:

$ chmod 744 file-name
  • 4 specifies the read permissions.
  • 2 specifies the write permissions.
  • 1 specifies the execute permissions.
  • 0 means no permissions were issued.

Or to grant full permissions to all users, type:

$ chmod 777 file-name

That’s it. Now you know how to Solve Bash Permission Denied. As you reviewed, the reason for the ”permission denied” error is the lack of required permissions. So, you learned how to change file permissions, take ownership, or use administrator privileges with the sudo command. with related commands.


It is because you have no write permission on your desired directory. Refer to solution 5 of this guide.


In this article, you learned How to Solve Permission Denied Error in Linux. As you know, regular users would face the ”permission denied” error because they have no sufficient privileges to execute various commands. Only root users (or users with sudo access) are allowed to change the permissions for the file or directory you prefer to access. Regardless of the configuration, the root user account always has full permissions on all files. Using the solutions in this guide help you to fix the permission denied errors in Linux.

If you follow the above methods properly then you can fix the permission denied errors in Linux. but do not hesitate to contact us if you encounter any problems. Our technical support team will try their best to solve your problems. Also, if you know some commands to fix this error, then the comment section is all yours.

Leave a Reply

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