Sre*_*ova -1 linux centos rhel
嗨,我在 CentOS 服务器上,我有一个用户叫,'theowner'所以他的文件夹位于/home/theowner
另一方面,我有 2 个文件夹,f1 和 f2 /home/myprojects/src,我只希望这些文件夹出现在下面,/home/theowner但我不想移动我想要的文件夹是将这2 个文件夹链接到/home/theowner. 它是针对c9工作区的,我只想让所有者在登录时直接访问该文件夹。谢谢!
@Lubomir已经给出了符号链接解决方案。
然而,他的解决方案将需要theowner至少有一个read-execute向所有的父目录的权限/home/myprojects/src/f1和/home/myprojects/src/f2。
在大多数情况下,您不想theowner看到/home/myprojects/src/f1和之外的任何内容/home/myprojects/src/f2。
绑定坐骑来救援。
作为theowner创建以下目录。
$ mkdir f1 f2
Run Code Online (Sandbox Code Playgroud)
As root,将源目录挂载到目标目录。
# mount -o bind /home/myprojects/src/f1 /home/theowner/f1
# mount -o bind /home/myprojects/src/f2 /home/theowner/f2
Run Code Online (Sandbox Code Playgroud)
如果您希望它在重新启动后持续存在,请在 /etc/fstab 中添加 2 个条目
/home/myprojects/src/f1 /home/theowner/f1 auto auto,bind 0 0
/home/myprojects/src/f2 /home/theowner/f2 auto auto,bind 0 0
Run Code Online (Sandbox Code Playgroud)
有了这个解决方案,theowner并不需要访问的父目录/home/myprojects/src/f1和/home/myprojects/src/f2。
| 归档时间: |
|
| 查看次数: |
9137 次 |
| 最近记录: |