Run applications as another user without switching
May 21, '04 08:42:00AM
Contributed by: slughead
This is regurgitating a hint I got from the comments section of another hint about Apache (I think). What this does is allow you to keep a program within the constraints of another user, without having that user logged in via the GUI. Run a suspect program within a bubble! I'd advise setting up a dummy account with very limited access if you wanted to make a "bubble." Note: I'm going to refer to the subsequent account as the "bubble account" and that account's session as the "bubble" from now on to give you the right idea about this.
- Open a new terminal window
- Type the following where short_name is the short name of the "bubble" account:
sudo short_name -
- Type the password to the "bubble" account.
- Type the following where app_name is the name of the app you wish to open:
/Applications/app_name.app/Contents/MacOS/app_name
For instance, this would launch Safari:
/Applications/Safari.app/Contents/MacOS/Safari
A couple of things to remember (very important!):
- Copying and pasting between this app and others will not work unless the others are also in the bubble.
- Apps running from within the bubble will still be able to launch subsequent applications under the original account (from what I can tell). For instance, going to an ftp:// URL in Safari while it's in the bubble will use the Finder running in the non-bubble account, with all available privileges.
- Closing the terminal (or hitting Ctrl+C while in the window) will close the app running within the bubble.
- Many programs will show exceptions and weird messages in the Terminal at various times while the program is running, if you've programmed before you'll know this is totally normal and expected.
- The programs running in the bubble may have different appearance settings than those you would otherwise run. To change this, login under the bubble account and go to System Preferences
- Running two copies of a program (one inside and one outside the bubble) works absolutely perfectly, in fact I'm writing this on my "bubbled" Safari app right now!
- Some problems may occur, like not being able to drag and drop using Safari. Work around them
- This does not seem to save preferences with the bubble account as file vault if the user is not logged in in the background.
I've tested this thoroughly, and it's pretty interesting I think.
[robg adds: This hint is the generic version of Run Mail as another user. I thought it was worth sharing the generic form in addition to the specific example...]
Comments (20)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040518224230789