Fix: cannot create directory permission denied

Linux displays the file or directory permissions held by the user via the “ls -l” command. These permissions are of three types: “read”, “write”, and “execute”. The “read” permissions are represented by “r”, and “write” permissions are identified by “w”, and the “execute” is denoted by “x” in Linux.

This guide describes the causes and possible solutions for the issue “cannot create directory permission denied”. The outline of this article is as follows:

Let’s get into the reasons and the solutions of the error.

Reason: Permissions Not Granted

The error “cannot create directory permission denied” occurs because the currently logged-in user does not have the “write” permissions to create the directory. Suppose the user runs the “mkdir” command to create the directory “test” and “subtest1” as a subdirectory. It will not create as it shows the below error shown in the screenshot:

$ mkdir test/subtest1

Check the “test” directory permissions by running the below-mentioned command:

$ ls -ald test

The owner “itslinuxfoss” does not have the write permissions to create the “subtest1” directory as it only reads the “test” directory.

To resolve this type of error, the user needs to access the write permissions of the “test” directory

Solution: Allow the Directory Permissions

Change the “test” directory permissions to create the “subtest1” directory inside it. For this purpose, use the “chmod(Change Directory)” command with the combination of “a+w” and the target directory name in the terminal (Ctrl+Alt+T):

$ chmod a+w test

The “test” directory now has the “write” permissions.

Execute the “ls” command again to verify the new changes:

$ ls -ald test

The output confirms that now the “test” directory has the “write” permissions to create a directory inside it.

Now run the “mkdir” command with the “subtest1” directory in the terminal. Now the below command will definitely create the “subtest1” directory without any error:

$ mkdir test/subtest1

The output verifies that the error “cannot create directory permission denied” has been fixed now, and the “subtest1” is created successfully inside the “test” directory.

Alternative Solution: Change the Directory Ownership

Here is another solution to create the directory. To perform this task, change the ownership of the specified directory using the “chown” Linux command. Run the below command in the terminal to make the current user an “owner” of the directory:

$ sudo chown -R "$USER:" /path/to/the/directory

The above command contains the following components:

  • chown: Linux command that is useful to change the ownership of file/directory.
  • -R: This flag represents “recursive” as it changes the ownership of files and subdirectories located in a directory.
  • $USER: The current user replaces the global variable.
  • path/to/directory: Shows the specified directory path.

That’s all about the reasons and the solutions to the error “cannot create directory permission denied”.


The “cannot create directory permission denied” can be resolved by “Allowing the Directory Permissions”.The permissions of the desired directory can be changed by utilizing the “chmod(Change Directory)” command. This article has explained all the possible solutions to resolve the error “cannot create permission denied” in Linux.