Restart VNC service REMOTELY!


You may never need this, but if you do, it is the best trick ever.
I administer my XSERVER remotely via the built in Apple VNC. However, the VNC service occasionally crashes, and locks my session. It also refuses any more VNC logins. This is particularly frustrating when I am off site! Apple has analyzed this and has no explanation or fix.
One talented and determined technician came up with this magic workaround. If SSH access is enabled on the server, you can connect to the server via an SSH client (PUTTY is great for Windows clients), and run this command:

sudo /System/Library/CoreServices/RemoteManagement/ -restart -agent

You must log in with admin rights, and must enter the admin password again to run the command. It can take a minute to run. After it finishes, VOILA! you can login again via VNC.
Believe me, this is a Godsend if you need it!
RoadKingRick - This is a neat trick. Every once in a while the VNC server goes down, just as you say, and I am permanently off site (I run daily display monitor updates for the place I used to work) and so would have to call the teck to go and reboot!! I appreciate you taking the time to post this.
- David
And that Apple KB is worth bookmarking for everyone who needs to remote control a server or wants to remote log in or control their (client) system remotely.

The use of kickstart to restart ARD or VNC services on the remote Mac system isn't limited to Mac OS X Server, it also works with the clients, as long as remote login is enabled. It has saved me countless steps...
Almost 9yrs later and this thread is still giving!

Just registered to say a massive thank you.