How to Fix a File Permission Denied on Linux

Last Updated : 10 Aug, 2026

A "Permission denied" error occurs when the Linux kernelโ€™s Virtual Filesystem (VFS) rejects an access request because it fails at one of its security layers. Even if you see a single error message, any one of these independent checks can cause the denial.

  • File Ownership & Permissions: Linux checks permissions in this order: Owner->Group->Others. If the matching category lacks the required r, w or x permission, access is denied.
  • Directory Permissions: Every directory in the file path must have execute (x) permission; otherwise, the file cannot be accessed.
  • Access Control Lists (ACLs): ACLs provide user-specific permissions that can allow or restrict access beyond standard file permissions.
  • Security Frameworks: SELinux and AppArmor enforce additional security policies that can block file access even when normal permissions appear correct.
Error
Error

Steps to perform Fix a File Permission:

Step 1: Changing File Permission

Check the file's current permissions using ls -l. If the file is not readable, grant read permission with chmod +r filename. Use sudo if administrative privileges are required. Syntax:

ls -l  or ls -l filename

Example: This will list the current permissions granted to the file.

ls -l

Output:

Check File Permissions
Check File Permissions

Step 2: Read Permisson

Grant read permission using the chmod command. Specify u (owner), g (group), o (others) or a (all), followed by +r to add read permission. Syntax:

chmod [recipient]+r filename

Example: This will grant read permission to the user, others and the group.

chmod og+r demo.txt      #read permission to other and group
chmod u+r demo.txt #read permission to user

Output:

File Permission Changed
File Permission Changed

Using sudo Command

If the file requires administrative privileges, use the sudo command to read it as the superuser. Syntax:

sudo cat <filename>

Example: Using sudo with cat command to read demo.txt file

sudo cat demo.txt

Output:

Reading file being superuser
Reading files being superuser

Change file Ownership

If the file is owned by another user, change its ownership using the chown command (requires administrative privileges). Syntax:

sudo chown <your_username> <filename>

Example: This command will change the ownership of the file and grant read permissions to the brahmbeyond user.

sudo chown brahmbeyond test.txt

Output:

Transferred the ownership from root to user
Transferred the ownership from root to user

To verify and read the file after granting permission, execute the below command in the terminal to read the contents of the file. Command:

cat test.txt

Output:

Reading File Contents
Reading File Contents
Comment

Explore