加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 使用sudo安全地使用find

发布时间:2020-12-13 18:24:37 所属栏目:Linux 来源:网络整理
导读:在 Linux服务器上,我需要从一组用户中删除root权限.但是这些用户有合理的理由能够使用“查找”实用程序根据文件名,修改日期和其他元数据搜索文件. 在服务器上,文件名不敏感,但文件内容可能不敏感. 我想使用sudo允许用户在服务器上的任何地方搜索文件. “查找
在 Linux服务器上,我需要从一组用户中删除root权限.但是这些用户有合理的理由能够使用“查找”实用程序根据文件名,修改日期和其他元数据搜索文件.

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

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

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

解决方法

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读