4

Is there any way to change the default vnc server port on a Mac. For the latest mac os version 10.7 Lion. The built in screen sharing, vnc server, is set to the default port of 5900. Would there be a plist hack for this by any chance?

  • i realize that with a descent router I can setup port forwarding with a different port number on the WAN side and set the LAN port to 5900. I have a NetGear WGR614v10 which can only set a static port forward with no outbound/inbound rules. so at moment if i wish to access my home mac from work i'll have to allow my router to forward requests on port 5900 to my internal ip on 5900. –  Jan 18 '12 at 03:12

3 Answers3

3

Ok. I spent a significant amount of time on this one myself. Short answer, it's not possible to change the default listening port of the built in VNC server on OSX Lion (except by possibly modifying the /private/etc/services file to change the rfb service to listen to something other than 5900 for TCP/UDP).

If that doesn't work, you can install the beta version of the Vine VNC server (http://www.testplant.com/support/downloads/vine/), have it listen on whatever port you want, and then connect to it with whatever free VNC client you wish (most recommend Chicken of the VNC http://sourceforge.net/projects/cotvnc/).

Ari Braginsky
  • 928
  • 1
  • 11
  • 21
1

Edit the server's plist file by opening the file below /System/Library/LaunchDaemons/com.apple.screensharing.plist in an editor.

Edit the line that reads <string>vnc-server</string> to <string>1234</string>where 1234 is the port number you wish to use.

After saving the file, turn Screen Sharing off and then on again .

Nevin Raj Victor
  • 2,924
  • 3
  • 23
  • 37
  • Great idea, I'm having trouble getting this to work, when I try to edit the file it says, chmod: Unable to change file mode on /System/Library/LaunchDaemons/com.apple.screensharing.plist: Operation not permitted, this is after I tried giving it 777 permissions but without any luck. I tried editing but it kept giving similar errors about operation not permitted, any ideas? – Joseph Astrahan Feb 13 '18 at 11:41
-1

Anything below port 1024 need root permission.

Albert Xu
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 02 '22 at 16:13