为什么当我能够切换到目录本身时,我不能以root用户的身份cd到一个拥有700个权限的符号链接目录中呢?
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这也发生在红帽上。
发布于 2019-03-21 17:40:07
我在这里找不到答案,所以我想把这个放在这里给其他人。
这里的行为取决于/proc/sys/fs/受保护_符号链接的设置。
root@plato:/tmp# cat /proc/sys/fs/protected_symlinks
1RedHat Bug 1034239 - root不能遵从其他用户拥有的符号链接
https://unix.stackexchange.com/questions/507781
复制相似问题