paw*_*wel 3 linux permissions ubuntu debian
我在我的服务器上拥有root权限,并且我想为特定组和用户授予权限.有一种情况,有目录树:
dir1
??? subdir1
??? subdir2
??? subdir3
Run Code Online (Sandbox Code Playgroud)
我有三个用户(user1,user2,user3) - 我希望他们每个人只有一个目录(user1 - subdir1,user2 - subdir2,user3 - subdir3)的权限.User1不应该能够看到int subdir2或subdir3,但是他看不到它们存在,与其他用户及其目录相同.
我使用getfacl和setfacl命令给出了持久性.
这些用户对dir1和subdirs有什么权限?
允许所有用户查看dir1设置权限0755 中的文件列表到此文件夹
$ chmod dir1 0755
Run Code Online (Sandbox Code Playgroud)
要分隔对子文件夹的访问,请将所有者分配给每个文件夹:
$ cd dir1
$ chown user1:user1 -R subdir1
$ chown user2:user2 -R subdir2
$ chown user3:user3 -R subdir3
Run Code Online (Sandbox Code Playgroud)
现在让子文件夹只对他们的所有者可读:
$ chmod user* 0700
Run Code Online (Sandbox Code Playgroud)
现在所有用户都看到文件夹user*存在,但是他们只能输入自己的文件夹
更新 抱歉,无法格式化评论中的文字.
当我有比这三个更多的用户时,我只希望这三个能够输入dir1 - 那么呢?
然后,您必须为它们分配一个特殊组,并允许该组读取dir1的内容.
创建组 specialusers
$ groupadd specialusers
Run Code Online (Sandbox Code Playgroud)
添加该组中的用户
$ usermod -aG specialusers user1
$ usermod -aG specialusers user2
$ usermod -aG specialusers user3
Run Code Online (Sandbox Code Playgroud)
允许specialusers读取文件夹
$ chown root:specialusers dir1
$ chmod dir1 0750
Run Code Online (Sandbox Code Playgroud)
现在,只有来自组的用户specialusers才能看到dir1下的文件夹列表
| 归档时间: |
|
| 查看次数: |
39498 次 |
| 最近记录: |