Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
大家好,我需要找到最深的嵌套可写文件夹:
我写了这个命令:find . -type d -printf '%d:%p\n' | sort -n | tail -1
find . -type d -printf '%d:%p\n' | sort -n | tail -1
但是如何添加条件“此文件夹可写”?
尝试这样做:
find . -type d -writable -printf '%d:%p\n' | sort -n | tail -1
man find说过 :
man find
- 可写 匹配可写的文件。这考虑了 -perm 测试忽略的访问控制列表和其他权限伪影。该测试使用了 access(2) 系统调用,因此可能会被执行 UID 映射(或 root-squashing)的 NFS 服务器所欺骗,因为许多系统在客户端内核中实现 access(2),因此无法使用服务器上保存的 UID 映射信息。
- 可写
匹配可写的文件。这考虑了 -perm 测试忽略的访问控制列表和其他权限伪影。该测试使用了 access(2) 系统调用,因此可能会被执行 UID 映射(或 root-squashing)的 NFS 服务器所欺骗,因为许多系统在客户端内核中实现 access(2),因此无法使用服务器上保存的 UID 映射信息。
这也适用于目录。