[英]How to find files and directories for user and exclude NFS mount and symbolic links ot NFS mounts?
I would like to find and change user account and it's default group on local File Systems but exclude massive NFS mounts and symbolic links to those mounts. 我想查找并更改用户帐户,它是本地文件系统上的默认组,但不包括大量NFS挂载和指向这些挂载的符号链接。 I had tried multiple syntaxes but did not succeed -
我尝试了多种语法,但没有成功-
find / -user dummyadm -print \( -fstype nfs -o type l \) -prune
Please help! 请帮忙!
It sounds like you're looking for the -xdev
option, or its synonym -mount
. 听起来您正在寻找
-xdev
选项或其同义词-mount
。 This causes find
to avoid crossing from one filesystem to another. 这导致
find
避免从一个文件系统跨到另一个文件系统。 The symbolic links should not be an issue in any case, because find
's default behavior is to not traverse symbolic links. 在任何情况下,符号链接都不应该成为问题,因为
find
的默认行为是不遍历符号链接。 This probably means you'll need to name all the filesystem roots you want to traverse, however. 但是,这可能意味着您需要命名要遍历的所有文件系统根目录。 For example, if both
/home
and /tmp
are on separate (local) filesystems, then you might do 例如,如果
/home
和/tmp
都在单独的(本地)文件系统上,那么您可能会这样做
find / /home /tmp -xdev -user dummyadm ...
Alternatively, if you want to use the -fstype
test, then you should probably combine it with -not
instead of trying to use -prune
with it: 或者,如果要使用
-fstype
测试,则可能应将它与-not
结合使用, -not
不是尝试与它一起使用-prune
:
find / -user dummyadm -not -fstype nfs ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.