我想使用sudo允许用户在服务器上的任何地方搜索文件. “查找”实用程序很棒,但它允许各种副作用,例如使用“-exec”生成任意命令.
我可以找到符合我的限制吗?
解决方法
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.