Thursday, July 17, 2008

Set the VNC Password for Mac's Remote Desktop in Terminal

I was stuck in trying to access one of our xserve machines that just got moved from the QA network to the Build network. I could connect via ssh, and Justin could ping it but attempting to connect with VNC wasn't working. It wouldn't accept the usual passwords. Justin seemed to think that it was possible to change the VNC password through the command line, so I google it and read a post from 2 years ago.

Something I've learned from reading "how-to" blogs is that you should always read the comments first. That's where the most up to date information will be, if there is any. The person who wrote the post used strange template structure that made his idea hard to read and understand. Anyone who didn't read the comments wouldn't know that kickstart now takes plain text passwords.

The long and short? If you want to change the VNC passoword do this:

sudo /System/Library/CoreServices/RemoteManagement/ -configure -clientopts -setvnclegacy -vnclegacy yes -setvncpw -vncpw [newpassword]

Apparently you can enable VNC access and set the VNC password via the kickstart command. It isn't terribly well documented, but since it now accepts plain text passwords, I think that's a step in the right direction.


Chris said...

Eep! If I hadn't been on vacation, I could have pointed you at the credential updating script we have that does precisely this for VNC on Mac.

Daniel E said...

I was able to do this via the Apple preferences panel based on the how-to in this article:

It is a little different in Leopard but I was able to find my way around.

I'm curious whether you are talking about something very different?

Lukas Blakk said...

daniel e - I am talking about being able to control the VNC settings when I can't access the desktop at all. With this machine in a distant location, and only ssh access, I needed a command line solution.