3

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?

2

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.)

  • What if I don't have a user name just a password? – gklka Apr 4 at 12:50
  • @gklka, logging into the remote machine is done with a username (and password), so there must be one! If you don't specify one, then it uses the one with which you're logged into the local machine. (That's the bit you pixellated out in your screenshot.) – gidds Apr 4 at 16:04
  • No, older version of VNC protocol (as fair as I know) does not use a user name. :( Anyway, it works for connecting via ⌘K, but not in saved .vncloc files. :( – gklka Apr 5 at 17:18
1

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.

0

Unfortunately following solution won't work for Ubuntu, but when dealing with Macs, here is what I did to get 1 click connection available on the Dock

  1. Shared target computer in iCloud "Back to my Mac" section
  2. Connected to that computer, by clicking "Share Screen" button in the Finders "Shared" section (that way it doesn't ask password when connecting, since it connects by iCould id, instead of ip)
  3. Created iMac.vncloc shortcut by dragging icon from Screen Sharing title bar (When saving shortcut from iCloud based session, shortcut doesn't ask for password either)
  4. Created Automator app "iMac", that runs shell script "open /Users/dmatora/Desktop/iMac.vncloc"
  5. Added "iMac" app to the Dock
  • I didn't test, but I think this solution only works between to Macs since you can't turn on "Back to my Mac" on an Ubuntu machine – Jules Dec 7 '17 at 10:46
  • Yeah, that's why I started from "Unfortunately following solution won't work for Ubuntu" :) – dmitry.matora Dec 8 '17 at 7:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .