我正在尝试更改链接的权限。我希望“其他”实体仅具有读取权限,但是当我运行命令时,权限不会更改。是否有什么我做得不正确,或者有不同的方法来更改链接的权限。
linux-gn77:~ # ls -l /usr/bin/startup.sh
lrwxrwxrwx 1 root dev 31 May 3 20:33 /usr/bin/startup.sh -> /usr/lib /tomcat7/bin/startup.sh
linux-gn77:~ # chmod 770 /usr/bin/startup.sh
linux-gn77:~ # ls -l /usr/bin/startup.sh
lrwxrwxrwx 1 root dev 31 May 3 20:33 /usr/bin/startup.sh -> /usr/lib/tomcat7/bin/startup.sh
linux-gn77:~ # chmod o=r /usr/bin/startup.sh
linux-gn77:~ # ls -l /usr/bin/startup.sh
lrwxrwxrwx 1 root dev 31 May 3 20:33 /usr/bin/startup.sh -> /usr/lib/tomcat7/bin/startup.sh
linux-gn77:~ # chmod o-r /usr/bin/startup.sh
linux-gn77:~ # ls -l /usr/bin/startup.sh
lrwxrwxrwx 1 root dev 31 May 3 20:33 /usr/bin/startup.sh -> /usr/lib/tomcat7/bin/startup.sh
请让我知道如何实现这一目标。谢谢
答案1
您无法更改链接的权限。您将需要更改目标的权限。这记录在man 2 symlink
:
The permissions of a symbolic link are irrelevant; the ownership is
ignored when following the link, but is checked when removal or renam‐
ing of the link is requested and the link is in a directory with the
sticky bit (S_ISVTX) set.
所以,为了实现你想要的,你需要运行
chmod 770 /usr/lib/tomcat7/bin/startup.sh