仅限 R 的访问权限

仅限 R 的访问权限

我如何才能仅授予 R (其他人)的访问权限?

例如,当用户运行时,ls他看不到文件列表,但可以读取文件,例如cat file26.txt

答案1

通过仅授予其他人对包含目录的执行 (x) 权限:

$ mkdir dir
$ chmod 0711 dir
$ echo yes > dir/file
$ su other_user -c 'ls dir'
Password:
ls: cannot open directory 'dir': Permission denied
$ su other_user -c 'cat dir/file'
Password:
yes

相关内容