AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 48109
Accepted
sal
sal
Asked: 2009-07-31 07:18:41 +0800 CST2009-07-31 07:18:41 +0800 CST 2009-07-31 07:18:41 +0800 CST

如何在 unix 上查找权限不正确的文件?

  • 772

我正在寻找一种方法来搜索一个或多个目录并列出对公共目录具有错误权限的所有文件。

linux unix permissions find
  • 3 3 个回答
  • 21254 Views

3 个回答

  • Voted
  1. Best Answer
    0x89
    2009-08-03T10:01:26+08:002009-08-03T10:01:26+08:00

    你的问题可以更清楚地说明,尤其是。公共目录的“错误权限”是什么意思?

    假设您希望目录为 755,普通文件为 644,我会这样做:

    $ find \! -perm 644 -type f -o \! -perm 755 -type d
    
    • 16
  2. sal
    2009-07-31T07:20:49+08:002009-07-31T07:20:49+08:00

    这对我有用

    find .  \! -perm +755
    

    该\!标志表示不是,该-perm选项使用正常的 chmod 选项

    • 5
  3. asdmin
    2009-07-31T09:41:02+08:002009-07-31T09:41:02+08:00

    一切都取决于您认为“不正确的许可”是什么。man find通过定义在给定权限下查找文件/目录的方式来帮助您:

       -perm -mode
              All of the permission bits mode are set for the file.  Symbolic modes are
              accepted in this form, and this is usually the way in which would want to
              use them.  You must specify ‘u’, ‘g’ or ‘o’ if you use a  symbolic  mode.
              See the EXAMPLES section for some illustrative examples.
    
       -perm /mode
              Any of the permission bits mode are set for the file.  Symbolic modes are
              accepted in this form.  You must specify ‘u’, ‘g’ or ‘o’  if  you  use  a
              symbolic  mode.  See the EXAMPLES section for some illustrative examples.
              If no permission bits in mode are set, this test matches  any  file  (the
              idea here is to be consistent with the behaviour of -perm -000).
    
       -perm +mode
              Deprecated,  old  way  of  searching for files with any of the permission
              bits in mode set.  You should use -perm /mode instead. Trying to use  the
              ‘+’  syntax with symbolic modes will yield surprising results.  For exam‐
              ple, ‘+u+x’ is a valid symbolic mode (equivalent to +u,+x, i.e. 0111) and
              will  therefore  not be evaluated as -perm +mode but instead as the exact
              mode specifier -perm mode and so it matches files with exact  permissions
              0111  instead of files with any execute bit set.  If you found this para‐
              graph confusing, you’re not alone - just use -perm /mode.  This  form  of
              the -perm test is deprecated because the POSIX specification requires the
              interpretation of a leading ‘+’ as being part of a symbolic mode, and  so
              we switched to using ‘/’ instead.
    

    • 3

相关问题

  • 你最喜欢的 Linux 发行版是什么?[关闭]

  • 更改 PHP 的默认配置设置?

  • 保护新的 Ubuntu 服务器 [关闭]

  • (软)Ubuntu 7.10 上的 RAID 6,我应该迁移到 8.10 吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    Windows 中执行反向 DNS 查找的命令行实用程序是什么?

    • 14 个回答
  • Marko Smith

    如何检查 Windows 机器上的端口是否被阻塞?

    • 4 个回答
  • Marko Smith

    我应该打开哪个端口以允许远程桌面?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    kch 如何更改我的私钥密码? 2009-08-06 21:37:57 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve