I am trying to change the ownership of a symbolic link (jakarta
) which points to another directory, but when I run
我试图改变指向另一个目录的符号链接(jakarta)的所有权,但是当我运行时
$ chown user1 jakarta
it changes the ownership of the directory that jakarta
is pointing to instead. Why?
它改变了jakarta所指向的目录的所有权。为什么?
$ chown -h user1 jakarta
ownership of `jakarta' retained as user1
1 个解决方案
#1
1
You are attempting to change the ownership of a symbolic link, however, the permissions of the link itself don't matter - what mappers are the permissions of the target that the link points to. If you do, for whatever reason, want to change the ownership of the actual symlink you can use chown -h
:
您正在尝试更改符号链接的所有权,但是,链接本身的权限无关紧要 - 哪些映射器是链接指向的目标的权限。如果你出于某种原因想要更改实际符号链接的所有权,你可以使用chown -h:
$ ll
total 4.0K
lrwxrwxrwx 1 root root 3 Mar 25 08:18 bar -> foo/
drwxrwxr-x 2 root root 4.0K Mar 25 08:18 foo/
$ chown -v quux:quux bar
changed ownership of `bar' from root:root to quux:quux
Note how it actually changed the target (foo
):
注意它实际上是如何改变目标(foo)的:
$ ll
total 4.0K
lrwxrwxrwx 1 root root 3 Mar 25 08:18 bar -> foo/
drwxrwxr-x 2 quux quux 4.0K Mar 25 08:18 foo/
$ chown -vh quux:quux bar
changed ownership of `bar' from root:root to quux:quux
$ ll
total 4.0K
lrwxrwxrwx 1 quux quux 3 Mar 25 08:18 bar -> foo/
drwxrwxr-x 2 quux quux 4.0K Mar 25 08:18 foo/
#1
1
You are attempting to change the ownership of a symbolic link, however, the permissions of the link itself don't matter - what mappers are the permissions of the target that the link points to. If you do, for whatever reason, want to change the ownership of the actual symlink you can use chown -h
:
您正在尝试更改符号链接的所有权,但是,链接本身的权限无关紧要 - 哪些映射器是链接指向的目标的权限。如果你出于某种原因想要更改实际符号链接的所有权,你可以使用chown -h:
$ ll
total 4.0K
lrwxrwxrwx 1 root root 3 Mar 25 08:18 bar -> foo/
drwxrwxr-x 2 root root 4.0K Mar 25 08:18 foo/
$ chown -v quux:quux bar
changed ownership of `bar' from root:root to quux:quux
Note how it actually changed the target (foo
):
注意它实际上是如何改变目标(foo)的:
$ ll
total 4.0K
lrwxrwxrwx 1 root root 3 Mar 25 08:18 bar -> foo/
drwxrwxr-x 2 quux quux 4.0K Mar 25 08:18 foo/
$ chown -vh quux:quux bar
changed ownership of `bar' from root:root to quux:quux
$ ll
total 4.0K
lrwxrwxrwx 1 quux quux 3 Mar 25 08:18 bar -> foo/
drwxrwxr-x 2 quux quux 4.0K Mar 25 08:18 foo/