Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to run an application as the user 'steve' with the window displayed on my desktop ( brendan ).

This is what I have been doing so far.

sudo -u steve open -a /Path/To/MyApplication.app

No matter which application I try, it always runs with my privileges and not steve's, which is not what I want. The process is owned by me, even though I executed open under 'sudo -u steve' .

How can I simply execute a command from the console that will open any application with different user's privileges ( steve being the owning user of the process )?

Also, GUI tools such as RunAs and Peek-A-Boo ( I think that's what it was called, very similar ) are not an option. This command must be launched from a bash/zsh/python/whatever script.

Thanks!

share|improve this question

migrated from stackoverflow.com Feb 5 '12 at 14:35

This question came from our site for professional and enthusiast programmers.

1 Answer 1

The easiest way I'm aware of is to use the full path to the executable. For example:

$ sudo -u steve "/Path/To/MyApplication.app/Contents/MacOS/MyApplication"

That definitely works (I've just tested it with several applications under Lion).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.