2

On a Linux system it is possible to find files that are owned by a uid that does not have a user name assigned with "find -nouser". I have been looking for an equivalent that will search the POSIX ACL lists for non-existent users, but have had no luck. Does anyone know of a method or utility to do this?

  • If find -exec getfacl results in an output distinctive to non-existent users (like a number instead of the user name), the results could be piped into a regular expression searching for this pattern. I would try it but I'm not about to create non-existent users just to find out. – kmarsh Mar 05 '14 at 17:05
  • Something like: find . -name '*.ext' -exec getfacl {} \; | grep "owner: [0-9]" If that works I'll make it an answer. :) – kmarsh Mar 05 '14 at 17:09
  • Using grep on the output of getfacl doesn't actually return the file name. It only returns the line with the uid instead of the name. – William Stockall Mar 05 '14 at 17:18
  • More on that grep "owner: " line. The "owner: " section of getfacl is the same as the owner find will see. I need to match the "user: " lines. – William Stockall Mar 05 '14 at 17:29
  • On my Linux system, "user:" lines show permissions like "rwx". The following can be used to combine lines (thanks to http://stackoverflow.com/questions/8545538/how-do-i-join-pairs-of-consecutive-lines-in-a-large-file-1-million-lines-using): find . -name '*.jpg' -exec getfacl {} \; | egrep 'file|owner' | sed -rn 'N;s/\n/ /;p' – kmarsh Mar 05 '14 at 18:55
  • You can substitute another data line for owner in the egrep argument if you like. – kmarsh Mar 05 '14 at 18:56
  • OK, this sed command combines every other line. If I have multiple users in the ACL it will stil return multiple lines. In the end what I want is to return the information in the "file:" line if the information in the "user:" line is numeric. – William Stockall Mar 05 '14 at 21:19
  • Sorry, I have no ACL filesystems to work with at the moment so no output to practice with... – kmarsh Mar 05 '14 at 21:24

0 Answers0