Using application as other user

apaschouch

Registered
Hello,

I use both macOSX and Linux. On Linux, I can log as another user (by telnet, rlogin, etc.), I can give graphical access (for example by xhost +), and then I can launch a graphical application from terminal.

I want to do the same under macOSX (so I don't need to relogin copmletely when I want to start the e-mail for an other user). But I didn't find how to launch macOSX applications from terminal, so I can't do the same thing. So my questions are :

- Is it possible to launch macOSX applications from terminal window (how) ?
- If yes, is there something special to do for launching an application for another user (like using xhost +) ?

Thank you for any information.

Alain paschoud
 

spriter

Registered
you can open mac os x gui apps in the command line using the open command. for instance you could open an app as the superuser by doing:

sudo open <path to application>

there is also a gui app called Pseudo that let's you do the same thing but without bothering with the command line...
 

iconara

Registered



just remember to open the actual binary and not the app-package:

Code:
[localhost:~] theo% open /Applications/Chess.app/Contents/MacOS/Chess



(hmmm, this failed for me... odd)

Theo
 

Klink

Member
and let's not forget the option for the command "open" in order to open an application rather than a file.

open -a /Applications/Calculator.app

or

open -a /Applications/TextEdit.app

or if you want to open as another user

sudo -u ausername open -a /Applications/Mail.app

I believe opening a GUI app remotely from the command line with Telnet or SSH will not redirect the video output to the remote terminal. You will need 3rd party software to get the video to happen.
 

rharder

Do not read this sign.
That didn't work for me. I think the window manager complains about the wrong user trying to access it.

-Rob
 

Klink

Member
Tested those commands except sudo -u and just assumed it worked how it was stated in man.

As Benny Hill said....
If you assume, you make an ASS out of U and ME.

Hope no one died because of that.

Actually I got this variant to work, which would mean it can be done to a certain degree.

sudo -u JoeBloe pico
 
Top