Ls: Cannot Open Directory: Permission Denied

I can't open a directory with username even after taking ownership & giving it all permissions:

sudo mkdir /path/to/the/directory/
sudo chown -R username:username /path/to/the/directory/
sudo chmod -R 777 /path/to/the/directory/

I get:

$sudo ls -al /path/to/the/directory/
total 0
drwxrwxrwx 1 username username   0 nov 16 15:13 .
drwx------ 1 root     root     208 nov 16 15:13 ..
$ ls -al /path/to/the/directory/
ls: cannot access '/path/to/the/directory/': Permission denied

What could be going on?

2

1 Answer

You have no rights on the parent directory

drwx------ 1 root     root   208 nov 16 15:13 ..

You must have the x rights on the parent directory to pass thru this directory

drwx--x--x 1 root     root   208 nov 16 15:13 ..

to do that :

sudo chmod go+x /path/to/the
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest