• 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: How can I "un-sudo" in postflight?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I "un-sudo" in postflight?


  • Subject: Re: How can I "un-sudo" in postflight?
  • From: Rustam Muginov <email@hidden>
  • Date: Mon, 02 Dec 2013 11:57:17 -0800

I am using something like this in my project:
    # 1. enumerate current users
    # 2. find the one with "console" in second column (the user with GUI session)
    # 3. only first found to be used
    # 4. print first column (GUI user name)
    home_user=`/usr/bin/who | /usr/bin/grep '^[^\w]*[\w]*console.*'| /usr/bin/head -1 | /usr/bin/awk '{ print $1 '}`



After finding user name, you can try something like
/usr/bin/su $home_user -l -c '/bin/launchctl load /Users/$home_user/Library/LaunchAgents/agent.plist'

not sure where i found it, might be in this list.
--
Sincerely,
Rustam Muginov
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
References: 
 >How can I "un-sudo" in postflight? (From: Mitchell J Laurren-Ring <email@hidden>)

  • Prev by Date: How can I "un-sudo" in postflight?
  • Next by Date: Re: How can I "un-sudo" in postflight?
  • Previous by thread: How can I "un-sudo" in postflight?
  • Next by thread: Re: How can I "un-sudo" in postflight?
  • Index(es):
    • Date
    • Thread