Linux – Can’t access a directory even with full permissions and ownership

linuxpermissions

I'm running into a weird issue. I have a directory, let's call it dir, which I (user) want to access. Having tried a few permission setups I can't get it to work, so I went to the extreme: change owner recursively to user:user, set permissions to 777. ls -hal now reports: lrwxrwxrwx 1 user user 94 Nov 16 10:35 dir.
Yet, when I try cd dir I get -bash: cd: dir: Permission denied. The only way to access the folder seems to be to first sudo su, but I want to be able to give access to other users without sudo privileges, and it would be nice to be able to use the directory myself without using sudo powers.

What can I do to get into the directory?

EDIT: I accidentally did the ls -hal in the wrong directory so it shows dir as a symlink, but the actual directory dir links to has the exact same permissions, and I can't get into it the 'normal' (just use absolute path instead of symlink) way either. However, weirdly I can't even ls -hal in the parent dir of the directory I want to access: ls: cannot open directory '.': Permission denied

EDIT: Apparently I just needed to log out and in again and everything worked. I guess ownership doesn't immediatly change when logged in?

Best Answer

The output suggests this is a symlink, so make sure the target directory has the correct permissions. Also, ensure that the specified user have the correct permissions to traverse all of the parent directories above this target directory.