Question:
Why am I not able to cd into a symlinked directory with 700 permissions, owned by a regular user, as root, when I am able to change into the directory itself?
Example:
ttucker@plato:/tmp# uname -a
Linux plato 4.4.0-140-generic #166~14.04.1-Ubuntu SMP Sat Nov 17 01:52:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
ttucker@plato:/tmp$ whoami
ttucker
ttucker@plato:/tmp$ mkdir -v test_dir
mkdir: created directory ‘test_dir’
ttucker@plato:/tmp$ chmod -v 700 test_dir
mode of ‘test_dir’ changed from 0775 (rwxrwxr-x) to 0700 (rwx------)
ttucker@plato:/tmp$ ln -s -v test_dir/ test_sym
‘test_sym’ -> ‘test_dir/’
ttucker@plato:/tmp$ ls -ld test_*
drwx------ 2 ttucker ttucker 4096 Mar 21 10:29 test_dir
lrwxrwxrwx 1 ttucker ttucker 9 Mar 21 10:29 test_sym -> test_dir/
ttucker@plato:/tmp$ sudo su -
root@plato:~# whoami
root
root@plato:~# cd /tmp/test_sym/
-su: cd: /tmp/test_sym/: Permission denied
root@plato:~# cd /tmp/test_dir/
root@plato:/tmp/test_dir# pwd
/tmp/test_dir
Other information:
This also happens on Redhat.