Enable VNC and Screen Sharing in Mac OS X Lion 10.7 from the command line
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all -clientopts -setvnclegacy -vnclegacy yes -vncpw mypass -activate -agent -console
This sets the password to “mypass” and enables vnc.
