How to unlock a Mac that's been locked with Apple Remote Desktop's "curtain" screen lock

Apple Remote Desktop has a "curtain" feature that a remote client can use to lock the screen of the Mac that's being remotely controlled. I use this when I connect to my work Mac from my home Mac. My work Mac's screen shows a big lock icon and a message while I'm remotely controlling it from my home Mac using Apple Remote Desktop (ARD).

Unfortunately, there's a bug of some kind that causes the remote Mac's screen to stay locked, even after I've disconnected from it. (Latest ARD and OS X 10.8.2 on both machines.) When this happens, I come in to work the next day to find the big lock icon and message on my Mac's screen. Despite now being physically present in front of the Mac, I can't find a way to unlock the screen.

I usually try ssh-ing into the Mac from another machine and killing processes. I've tried killing the ARDAgent process, the screen lock process (I can't recall the name), and anything else I can find with "ard" or "remote" in the process name. None of these things seem to unlock the screen. Eventually, I resort to using osascript -e ... to tell all my running applications to gracefully quit, then I run shutdown -r now to reboot the machine.

My question: is there a way to successfully unlock a Mac that's stuck on the ARD lock screen, using ssh or otherwise?


One way to reproduce this: Log in to the target Mac with Remote Desktop, initiate Curtain mode, and then after finishing whatever work was to be done, log out the user on the target Mac while still under Curtain mode. This will leave the Mac inaccessible to the Remote Desktop app and even a physical user of the computer, with the large lock icon still on the screen of the target Mac.

I'm not sure what I'm doing to trigger this situation, but I'm definitely not logging out. Either way, it seems like the solution should be the same.


Solution 1:

I don't have a Mac with ARD to test this, but this sunshine-ard utility suggests it can fix the problem. From a quick glance at the source code, it just sends a CFNotificationCenter message to quit the curtain mode.

I'm not sure if there's a way to hook in to the ARD logout process to have this run every time you disconnect your session, but at the very least you could run it via SSH as necessary.

Solution 2:

This fastest solution I have found is to make a SSH connection to a admin account on the remote computer that is locked.

ssh "adminuser"@ip.address/or.computername

Type: ps -ax | grep AppleVNCServer

You want the line that reads something like

/System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/Support/LockScreen.app/Contents/MacOS/LockScreen -session 256 -msgHex 

Jot down the PID that is to the left of this.

then enter:

sudo kill -9 "PID" 

This will force restart the lock screen and make it available again.

I know this is like the post above just explained. It is also done on two 10.8.2 machines running ARD 3.6.1.

Solution 3:

For what it's worth, this is a known bug in ARD and has apparently been around for a while. This Apple KB has an article about it, but no suggestion on how to fix it. http://support.apple.com/kb/TS2401

Key part of the document:

If you use Remote Desktop to take control of a client using Curtain mode, then log in or log out on the remote client, the control session will end and you will not be able to take control of the computer again until it is restarted. This occurs on client running Mac OS X v10.5 or later, and will also occur if you Lock the Screen of the client before taking Control.

Resolution

Before logging out, close any windows with sensitive information, end the control session (and Unlock Screen if necessary). Do not log out on the remote client while controlling it in Curtain mode.

Solution 4:

If you're on El Capitan, the above instructions involving killing the lock screen won't work. There's some process that keeps starting it up and I was unable to find it using launchctl list. I also tried to shut down ARD via my ssh login but that didn't work either. Apparently the LockScreen.app and ARD are decoupled processes or something. I wound up having to do a shutdown -r now to force a reboot. I'm pretty pissed that Apple hasn't fixed this bug or provided a workaround that, you know, actually works AFTER the fact.