Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Execute GUI commands as another user' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Execute GUI commands as another user
Authored by: mj on Feb 21, '03 09:24:03PM

You can actually use GUI programs as root without logging out—it just involves restarting the program you want to use as root. So, on the rare occasion I need to use the Finder as root, I

osascript -e 'tell app "Finder" to quit'
sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

If you look up the Finder's PID, you could also quit it with

sudo kill -HUP <finder_pid>

but I'm not sure if the Finder will quit cleanly that way. When you're done, you can quit the same way, and start the Finder as yourself as above without the sudo, or by clicking in the Dock.

My slight guesswork explanation as to why this works is that root, having access to everything, has access to your display interlocks (whatever those are), and so can use your display. I imagine that with the appropriate tweaking of groups and permissions that you could set up your computer to allow you to use your display as other users, too.

MJ



[ Reply to This | # ]