use*_*822 8 permissions symlink tmp permission-denied
我的机器上有 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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
现在,虽然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
Run Code Online (Sandbox Code Playgroud)
我的问题是,如果他可以读取目标以及他在与符号链接相同的目录中拥有的另一个文件,为什么不能otheruser
读取其拥有linuxlite
的符号链接?
如果重要,那么权限/tmp
是:
otheruser@linuxlite:~$ ls -l -d /tmp
drwxrwxrwt 9 root root 4096 Mar 31 13:17 /tmp
Run Code Online (Sandbox Code Playgroud)
发行版为 Linux Lite 3.0,内核为:Linux 4.4.0-21.generic (i686)
Linux Lite 基于 Ubuntu,它限制了世界可写粘性目录(包括/tmp
)中的符号链接:符号链接只能由其所有者取消引用。
如果您在其他地方(/home/linuxlite
例如)创建符号链接,您将能够以您期望的方式取消引用它。
(Ubuntu 并不是唯一以这种方式运行的发行版;我提到了 Linux Lite 和 Ubuntu 之间的联系,因为这方面的文档似乎是特定于 Ubuntu 的。)
归档时间: |
|
查看次数: |
592 次 |
最近记录: |