searching through all user accounts

  • Hi,

    I have a search app which normally searches through the current users home directory using NSTask and find command.  If I wanted to make it search through all user accounts could I ask some advice on what is the best way to make it work?  Because I know permissions will be an issue.  Thanks,

    rc
  • On Sun, Jul 29, 2012 at 06:23:14PM +0800, Rick C. wrote:
    > Hi,
    >
    > I have a search app which normally searches through the current users home directory using NSTask and find command.  If I wanted to make it search through all user accounts could I ask some advice on what is the best way to make it work?  Because I know permissions will be an issue.  Thanks,
    >
    > rc

    You can iterate through all users using getpwent() and run one task per
    user. Find will just ignore any directories and files which it doesn't
    have permission to read. If you want to go around that then you will
    have to for example elevate to a user that have the appropriate access
    rights or add ACL's that allows you to read.

    Marcus
  • On Jul 29, 2012, at 3:23 AM, Rick C. <rickcorteza...> wrote:

    > I have a search app which normally searches through the current users home directory using NSTask and find command.  If I wanted to make it search through all user accounts could I ask some advice on what is the best way to make it work?  Because I know permissions will be an issue.  Thanks,

    Read the docs on Authorization Services.

    —Jens
  • Thank you all!

    rc

    On Jul 30, 2012, at 3:23 AM, Jens Alfke <jens...> wrote:

    >
    > On Jul 29, 2012, at 3:23 AM, Rick C. <rickcorteza...> wrote:
    >
    >> I have a search app which normally searches through the current users home directory using NSTask and find command.  If I wanted to make it search through all user accounts could I ask some advice on what is the best way to make it work?  Because I know permissions will be an issue.  Thanks,
    >
    > Read the docs on Authorization Services.
    >
    > —Jens
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today