我正在关注Linux 从头开始(LFS)在 Ubuntu 22.04 上。其中有一段写道:
通过使 lfs 成为目录所有者,授予 lfs 对 $LFS 下所有目录的完全访问权限:
chown -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools}
case $(uname -m) in
x86_64) chown -v lfs $LFS/lib64 ;;
esac
lfs
是用户,LFS
是/mnt/lfs
路径。我使用了脚本,输出为:
ownership of '/usr' retained as lfs
ownership of '/usr/bin' retained as lfs
ownership of '/usr/games' retained as lfs
ownership of '/usr/include' retained as lfs
ownership of '/usr/lib' retained as lfs
ownership of '/usr/lib32' retained as lfs
ownership of '/usr/lib64' retained as lfs
ownership of '/usr/libexec' retained as lfs
ownership of '/usr/libx32' retained as lfs
ownership of '/usr/local' retained as lfs
ownership of '/usr/sbin' retained as lfs
ownership of '/usr/share' retained as lfs
ownership of '/usr/src' retained as lfs
ownership of '/lib' retained as lfs
ownership of '/var' retained as lfs
ownership of '/etc' retained as lfs
ownership of '/bin' retained as lfs
ownership of '/sbin' retained as lfs
chown: cannot access '/tools': No such file or directory
failed to change ownership of '/tools' to lfs
ownership of '/lib64' retained as lfs
我以为它会授予 /mnt/lfs 下的访问权限,但输出却显示其他内容。有什么问题吗?还是没问题?
编辑:我觉得我没能正确地提出我的问题。我不是在问为什么我不能获得所有权/tools
。我是在问为什么这些代码试图获得我系统的根目录的所有权,而它说它将获得/mnt/lfs
AKA$LFS
目录下的目录的所有权。
不是$LFS/{usr{,/*},lib,var,etc,bin,sbin,tools
意味着类似
/mnt/lfs/usr
/mnt/lfs/lib
/mnt/lfs/etc
...
但它试图直接获得所有权
/usr
/lib
/etc
...
/tools
这不是这个问题的重点。