• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: FindFolder/sudo puzzle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FindFolder/sudo puzzle


  • Subject: Re: FindFolder/sudo puzzle
  • From: Andy O'Meara <email@hidden>
  • Date: Sat, 24 May 2008 18:42:29 -0400


Thanks for the suggestions, Kevin. Unfortunately, I now realize that our little app runs under sudo root, it doesn't even matter if it know the right dir since any files or dir it creates will get tainted with root permission/ownership. Basically, this seems to rule out being able to write any files once the installer is in preflight (since its sudoed at that point).


The only idea I have remaining is launching my app using sudo -u, which would solve the FindFolder() issue as well as the file owner/ permissions issue. The only thing left, however, is to choose the most reliable method to to get the username (or uid). The most obvious method would be the following in preflight:

MY_RESULT=`sudo -u "${USER}" "$1/Contents/Resources/MyApp.app/Contents/ MacOS/MyApp"`

Does anyone see any issues with this for use in 10.3 and later? Is it safe for me to be using USER?

Thanks,
Andy




On May 24, 2008, at 11:31 AM, Kevin Grant wrote:

You'd have an unprivileged process somewhere.  There's at least a
couple of ways to do it:

- make "the installer" a tiny unprivileged program that derives
 the user directory, and then runs the "real" installer program
 (passing the path, e.g. through an environment variable)

- run the installer itself without privileges; invoke the 2nd app
 immediately, then request administrator privileges later

Kevin G.


Here's an interesting one...

Our installer package has to run an app that runs that ultimately needs to create a file in the current user's preferences dir. At first glance, calling FindFolder() with kUserDomain would be the way to get the the desired pathname. Unfortunately, however, since the installer is running under sudo, all the paths returned by FindFolder() point into /private/var/root, etc. So the question becomes, is there any way to get the correct info from FindFolder()?

The goal would be to come up with something as reliable as possible that doesn't contain any hard-coded paths/assumptions.

Thanks in advance,
Andy

_______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: FindFolder/sudo puzzle
      • From: Stéphane Sudre <email@hidden>
    • Re: FindFolder/sudo puzzle
      • From: Bill Coderre <email@hidden>
  • Prev by Date: svn and missing empty directories
  • Next by Date: Re: FindFolder/sudo puzzle
  • Previous by thread: Re: svn and missing empty directories
  • Next by thread: Re: FindFolder/sudo puzzle
  • Index(es):
    • Date
    • Thread