Ray*_*tre 13 ssh permissions chmod symbolic-link
在 OSX 中,我可以设置符号链接本身的权限(而不是使用 -h 指向的内容)。从手册页:
-h If the file is a symbolic link, change the mode of the link itself rather than the file that the link points to.
Run Code Online (Sandbox Code Playgroud)
在 Ubuntu 14.04 中,我尝试设置符号链接的权限,但它仅在符号链接目标上设置。
它是关于从一个符号链接/home/nagios/.ssh/someprivatekey到/somewhere/else/privatekey,这样的权限是SSH重要。我怎样才能做到这一点?
Rin*_*ind 18
不可能。没有办法,因为符号链接的权限没有意义(符号链接不是文件;它只指向一个文件)。不过,在 Linux 上执行此操作的方法是通过ACL。
符号链接被解释为...
创建的符号链接的文件模式位的值是未指定的。POSIX.1-2008 指定的所有接口都应该表现为符号链接的内容总是可以读取的,除了在 stat 结构的 st_mode 字段中返回的文件模式位的值是未指定的。
不同之处在于:chmod和chmod ......它是 BSD 与 Linux。
不确定它是否重要,但关于 SSH:它使用 stat(2)而不是 lstat(2) 来获取权限。
你不能。底层chmod系统调用在 Linux 中根本不支持这一点,因此,Linux 也不关心链接的权限。来自man chmod:
chmod never changes the permissions of symbolic links; the chmod system
call cannot change their permissions. This is not a problem since the
permissions of symbolic links are never used. However, for each
symbolic link listed on the command line, chmod changes the permissions
of the pointed-to file. In contrast, chmod ignores symbolic links
encountered during recursive directory traversals.
Run Code Online (Sandbox Code Playgroud)
至于硬链接或绑定挂载,使用源的权限,因此在其他地方反映文件内容的三种标准方法中没有一种可以帮助您。
| 归档时间: |
|
| 查看次数: |
1615 次 |
| 最近记录: |