我的机器上有2个用户:linuxlite
和otheruser
。
otheruser
有一个文件:
otheruser@linuxlite:~$ ls -l a
-rw-rw-r-- 1 otheruser otheruser 6 Mar 31 12:47 a
otheruser@linuxlite:~$ cat a
hello
linuxlite
在中创建了一个文件和一个符号链接/tmp
:
otheruser@linuxlite:~$ ls -l /tmp/file /tmp/link
-rw-rw-r-- 1 linuxlite linuxlite 3 Mar 31 12:49 /tmp/file
lrwxrwxrwx 1 linuxlite linuxlite 17 Mar 31 12:49 /tmp/link -> /home/otheruser/a
现在,尽管otheruser
可以阅读/tmp/file
和/home/otheruser/a
,但他无法阅读/tmp/link
:
otheruser@linuxlite:~$ cat /tmp/file
hi
otheruser@linuxlite:~$ cat /home/otheruser/a
hello
otheruser@linuxlite:~$ cat /tmp/link
cat: /tmp/link: Permission denied
我的问题是,如果他可以读取目标以及他拥有的与该符号链接位于同一目录中的另一个文件,为什么不能otheruser
读取其拥有linuxlite
的符号链接?
如果很重要,那么对的权限/tmp
为:
otheruser@linuxlite:~$ ls -l -d /tmp
drwxrwxrwt 9 root root 4096 Mar 31 13:17 /tmp
发行版是Linux Lite 3.0,内核是:Linux 4.4.0-21.generic(i686)
Linux Lite基于Ubuntu,它限制了可在世界范围内写入的粘性目录(包括/tmp
)中的符号链接:此处的符号链接只能由其所有者取消引用。
如果您在其他地方(/home/linuxlite
例如)创建符号链接,则可以按期望的方式取消引用。
(Ubuntu并不是唯一以这种方式运行的发行版;我提到了Linux Lite和Ubuntu之间的连接,因为该文档似乎是特定于Ubuntu的。)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句