Can I remote desktop to another user on the same machine?

On my work Mac, which stays physically in my work office, I want to keep my work stuff separate from my personal stuff by using two different user accounts. I normally stay logged in as the 'work' user. But I want to have them visible at the same time, since I have a large screen. I think I could get a nice setup if I could use the built in remote desktop client or a 3rd party VNC client to connect to the login screen of the existing machine, so that I can select a different user. Or if I could connect as a specific user, even though the physical machine is already logged in as someone else.

I normally use my system with "remote management" mode enabled (not just remote desktop), and I often use a VNC client at home to access my Mac desktop at work. Although this is not my daily routine. In this mode the VNC client immediately connects to the existing desktop. Is there a way I can force this connection to go to the login screen instead? When I use a VNC client to connect to the existing screen, I can see it trying (you get the kind of infinite regress that you might expect), so the basic connection works. I just want it to let me select another user.

Edit: I think part of the problem is that the system might be running a VNC server session in the background waiting for me to connect. It connects to the active session. It seems to happen either when I have "remote management" turned on or just "screen sharing". Using an alternate user in an "open" command results in an error about not being able to control your own screen.

To be clear, both accounts are on my work computer. From home I want to connect to my "work user" on my work computer. From my desk at work, logged in as my "work user" I want to be able to connect to the "personal user" on my work computer.

I think my real problem is related to what happens on the server side of the connection. I want the OS to fire up the login window even through there is a user logged in on the main screen/keyboard. I know that is some circumstances a remote-login user can receive the login screen. It might be necessary for me to give up the idea of sometimes connecting to the logged-in user and sometimes connecting with a fresh login. If I can switch completely to the fresh-login mode that would be a start.

How does Mac OS decide whether to show the login-screen for a remote connection versus just connecting you to the running desktop? I thought it was related to having "remote management" turned on vs "screen sharing". But with just "screen sharing" turned on, I still get the connect-to-existing behavior.


Solution 1:

ARD into your "work account" and then do the following on the remote computer to open a Screen Sharing window to your "personal account" on the same remote computer.

Create an SSH tunnel. It works for me using 10.9.

Enable Remote Login (SSH) in System Preferences > Sharing, and in Terminal run:

ssh -NL 5901:localhost:5900 localhost

Finally, use Screen Sharing to connect to localhost:5901 (instead of the default port 5900). Instead of port 5901 you can use a much higher port that isn't in use by anything else.

The Screen Sharing application is located here: /System/Library/CoreServices/Screen Sharing.app

Solution 2:

You can specify a specific user using the open command in terminal.

open vnc://user:password@hostname(or IP)

This is also achievable through Go Connect to Server ( cmd + k) from the finder and entering vnc://hostname(or IP)

You can only have two users running on one machine remotely.

Solution 3:

To clarify @mindmischief answer, here are the steps to set it up:

  1. (optional) Create a new user (e.g. vnc) in Preferences/Users with the password.
  2. In Preferences/Sharing, enabled Screen Sharing and Remote Login (also Allow access for it).
  3. Verify that ssh vnc@localhost works.
  4. Run: ssh -NL 5901:localhost:5900 vnc@localhost (as per this post).

Note: You can use different user than vnc. For debug, add -vvv to your ssh command.

Now open the VNC connection by the following command:

open vnc://localhost:5901/