Another "Untrusted apps can't connect before login&quot

Hi, I’ve used the OSXvnc-server tool for years. It works great – thank you.

I recently upgraded from OS X Tiger to Leopard, which (as you know) has broken the ability to use OSXvnc-server when no one has logged in yet. I read through the forums but couldn’t find a definite answer: is there any way around this besides logging in prior to starting OSXvnc?

The workflow I’ve always used is to first SSH into the Mac. Once in, OSXvnc is started with a command like “sudo /Applications/Vine\ -rfbport 5900 -maxdepth 8 -localhost”. I’ve never launched the Vine application and have always preferred using OSXvnc-server directly (probably mostly because I think I started using it before Vine even existed and it worked great, so seemed extraneous). I’ve also always preferred to not have OSXvnc-server running if it wasn’t going to be used, so that’s why I like starting it manually. Maybe this is different than most other users.

Anyway, is it possible to still do this (start OSXvnc-server upon demand from the command line and manually kill it when it’s no longer needed)? And is there or will there be any way to start OSXvnc-server if the machine hasn’t been logged into?

Thanks a lot, and thanks for an incredibly useful piece of software.

In order for it to work on 10.5 before a user has logged in it needs to be started in the proper context. This can be done if you use the GUI app and create a “System Server”.

You can also do it yourself by hand using LaunchD but it’s a little bit harder. The easiest thing if it’s a remote machine is to use the GUI to create a system server on a local machine and then copy the launchd config file (in /Library/LaunchAgents). You can readup more on launchd by doing

man launchd

Thanks Jonathan. So it sounds like you use the GUI app one time to define a startup entry to OS X, kind of like what Lingon would do? Once this is done, does that make OSXvnc-server automatically run at bootup, or does it just adjust the context so starting it manually will work?

You can do it by hand with Lingon if you prefer, but there are some special flags you have to set (which escape my memory buffer at the moment).

Anyhow, this won’t modify the OSXvnc-server executable. In order to use OSXvnc before login you WILL need to launch OSXvnc-server via LaunchD. It’s really up to you if you want to configure it to launch automatically on boot or if you want to have to use launchctl to fire it off through SSH.

After spending all night trying to figure out what launchd and launchctl were about, I finally gave up and just ran the VNC server app and had it enable a system server. I connected from my PC and successfully got the OS X login screen, but when I logged into OS X then the VNC connection was terminated and successive attempts to reconnect failed. Is that a known issue?

It is a known issue that you the server will drop your connection to the log-in window. But shortly thereafter (maybe 20 seconds) you should again be able to login (this time to view your user session). If it didn’t come back that is definitely a bug/problem.

Wow, ok. I just tested it by remotely logging out to the OS X login screen and then attempting to log back in. Even several minutes later VNC couldn’t connect.

Is there some logging that would help identify what’s going on?


Please try the Vine Server 3.1Beta and see if that resolves your issue.

Thanks for your help, but unfortunately the beta version didn’t work out. Here’s the scenario:

  1. The host computer is sitting at the login screen.

  2. I SSH in from another computer and can successfully bring up a VNC connection.

  3. Using VNC I log on to my user account (on the host computer) and my VNC connection drops.

  4. Any reconnect attempts fail.

  5. However, if I manually kill the OSXvnc server job then a new one is started up – and then VNC can connect. Once I had to kill the OSXvnc server job two times (sequentially) before it would connect.

I’m not sure what’s causing this, but this is a brand new OS X installation on a new (to me) iMac, so I’d think it would be a pretty vanilla environment. Is there anything else I can try?

Please try changing the port that Vine Server is running on, it sounds like it might be conflicting.

So it wasn’t the port, but I think what is happening is that the connection gets dropped and then new VNC connections are refused because it doesn’t know it was dropped. I haven’t thoroughly tested it out, but it looks as if changing the Shared Connection parameters may resolve the issue, by making new VNC connections replace the old ones.