[lustre-discuss] lfs find to locate files with specific permissions

Andreas Dilger adilger at whamcloud.com
Fri Jul 27 11:48:33 PDT 2018


On Jul 27, 2018, at 11:16, Ms. Megan Larko <dobsonunit at gmail.com> wrote:
> 
> Greetings List!
> 
> Recently I have been looking for dirs with world write access.  I can do this on most file systems, including Lustre, with linux/POSIX "find /my/src/dir -type d -perm 777", for example.  I was going to invoke an "lfs find" on those file systems of type Lustre but I do not see a "-perm" option to the "lfs find".   Am I missing anything here?   Have I only the linux "find" for searching for permissions settings?
> 
> FYI, the Lustre file systems are 2.7.3, 2.9.0 and 2.10.4 servers with clients 2.7.3 and newer.

Hi Megan,
indeed there is no -perm option for "lfs find", but nobody has ever asked
about it before.  This is one of the cases where "lfs find" could be faster
and/or less resource intensive compared to regular find, since the file
access permissions are stored on the MDT, so there is no need to get the
size/timestamps from the OST(s) for each file.

Could you please file a ticket at https://jira.whamcloud.com/ to track
this issue.  If you are inclined to try it, I suspect it wouldn't be very
hard to add this functionality to lfs, and since it would only affect
the user-space lfs command it would be a very low-risk modification (not
even root permission needed to build/test the patch).

It would just be a matter of copying the code that handles "-type" or
similar, and then modifying it to compare the mode.  The tricky part
is getting the semantics correct with +/-mode, and converting symbolic
modes to octal (the find(1) man page goes into depth on this issue).
Starting with only "[+-]octal" may be enough for your purposes.

Cheers, Andreas
---
Andreas Dilger
CTO Whamcloud




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.lustre.org/pipermail/lustre-discuss-lustre.org/attachments/20180727/a31d7465/attachment.sig>


More information about the lustre-discuss mailing list