linux – 使用sudo安全地使用find

前端之家收集整理的这篇文章主要介绍了linux – 使用sudo安全地使用find前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Linux服务器上,我需要从一组用户删除root权限.但是这些用户有合理的理由能够使用“查找”实用程序根据文件名,修改日期和其他元数据搜索文件.

在服务器上,文件名不敏感,但文件内容可能不敏感.

我想使用sudo允许用户在服务器上的任何地方搜索文件. “查找”实用程序很棒,但它允许各种副作用,例如使用“-exec”生成任意命令.

我可以找到符合我的限制吗?

@H_404_9@解决方法
locate怎么样?

locate reads one or more databases prepared by updatedb(8) and writes
file names matching at least one of the PATTERNs to standard output,
one per line. If –regex is not specified,PATTERNs can contain
globbing characters. If any PATTERN contains no globbing characters,
locate behaves as if the pattern were PATTERN.

By default,locate does not check whether files found in database
still exist. locate can never report files created after the most
recent update of the relevant database.

或者甚至可能是slocate

Secure Locate provides a secure way to index and quickly search for
files on your system. It uses incremental encoding just like GNU locate
to compress its database to make searching faster,but it will also
store file permissions and ownership so that users will not see files
they do not have access to.

This manual page documents the GNU version of slocate. slocate Enables system users to search entire filesystems without displaying unauthorized files.

猜你在找的Linux相关文章