How to skip OS X VNC connect password requester?

I have an Ubuntu server which I tend to use via VNC from OS X. For this, I have saved a .vncloc file from the built-in Screen Sharing client. When I click this icon, Screen Sharing connects to Ubuntu, but shows this requester already filled in:

enter image description here

Since I saved my password in my Keychain, I just have to press enter every time. Is it possible to skip this requester somehow and connect immediately using the saved credentials?


The questioner already has a .vncloc file, so the simplest answer is to add the username into that file:

  • Locate the file.  (If you haven't moved it, it'll probably be in ~/Library/Application Support/Screen Sharing/.)

  • Ensure you have write permission.  (E.g. with the Finder, or chmod +w.)

  • Open it in your favourite text editor (e.g. vim).

  • Edit the first line with vnc://<address> to read vnc://<username>@<address>.

  • Save it.

The file will then connect directly to the remote system, skipping the password dialog entirely.

You can run it by double-clicking on the file in the Finder, dragging the file onto the Dock, or using open from the command line.

(Alternatively, you can include the username in the vnc: address when first creating the file.)


Applescript. Enable Accessibility when prompted.

do shell script "open vnc://username@thisaddress:portnumber"

delay 2

tell application "System Events" to tell application process "Screen Sharing" ¬
to tell window 1 to click (first button whose name is "Connect")

Use Automator to save the script as an app.