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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like