stweil / OSXvnc

VNC Server for macOS
GNU General Public License v3.0
198 stars 64 forks source link

Can't log to System Server without logged user in Big Sur 11.4 #47

Open ceztko opened 2 years ago

ceztko commented 2 years ago

I'm trying to use Vine Server because of poor performance of free VNC clients on Windows connecting to the stock "Remote Management" feature of MacOS. Vine Server has better performance and other basic features like copy and paste work so I'm very happy with that. What I'm trying to do is connecting to the "System Server" after a reboot, and the service apparently is not running. The machine has also the built-in "Remote Management" enabled on the TCP port 5900, so I can login with that and start a new session to the System Server which automatically starts on a different port (5901) after the user is logged. The UI caption seem to suggest that the System Server should start independently of any logged user so what I should expect here? Is there a bug in Vine Server, am I missing something or simply this is an unsupported scenario?

kalaklanar commented 2 years ago

I hate to "Me too", but this is why I stopped using the system server. Even if it started, it still had a problem with connections. I had to turn on auto-login for other reasons, so I just had it auto-launch on login. Before that, I'd connect to the Remote Management vnc server, log in, and let the Vine Server application start. Then I'd switch to the Vine server port.

stweil commented 2 years ago

Personally I have no own experience with that feature of Vine Server, so I have to check it myself. This will take a while because of other business, so if anybody else finds a solution I'll be happy to integrate it.

ceztko commented 2 years ago

When selecting the "System Server" the process appear to be still launched with the credentials of the same user of the logged session. I'm expecting the process to be launched either with root or another administrative user. I guess this was the intended behavior so this may be more a bug/regression caused by a change in the OS.

crystall1nedev commented 2 years ago

A bit of a stale issue but I'm encountering this issue as well. I may have found a possible workaround, so stay tuned.

crystall1nedev commented 2 years ago

So the workaround is a bit of a mess. I hope it's only temporary. Essentially, you need to write a bash script and launch daemon, and then give bash permission to control your computer with accessibility features. Noted issues:

ceztko commented 2 years ago

Macos is not my primary platform. The script you are using plus the commands to demonize it would be very appreciated.

crystall1nedev commented 2 years ago

Here's com.osxvnc.systemserver.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>

    <key>Label</key>
    <string>com.osxvnc.systemserver.plist</string>
    <key>RunAtLoad</key>
    <true/>
    <key>EnvironmentVariables</key>
    <dict>
      <key>PATH</key>
      <string><![CDATA[/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin]]></string>
    </dict>
    <key>ProgramArguments</key>
    <array>
      <string>/bin/bash</string>
      <string>-c</string>
      <string>/Library/systemserver.sh</string>
    </array>
  </dict>
</plist>

Here's the /Library/systemserver.sh script

/bin/bash -c '"/Library/Application Support/VineServer/OSXvnc-server" -rfbport <vncport> -desktop <computer name> -rfbauth "/Library/Application Support/VineServer/.vinevncauth" -systemserver 1 -alwaysshared -restartonuserswitch N -unicodekeyboard 0 -keyboardloading y -pressmodsforkeys y -eventtap 3 -eventsource 2 -swapbuttons -rendezvous n'

(The original files are tailored towards my automatic booting of a noVNC server on this system)