1

I am having issues using VNC between MacOS X and Linux.

I installed tightvnc server on CentOS Linux and vncviewer on Mac OS X. I have done all the setting to my best knowledge and then started vncserver on the Linux computer. I also opened the port 5901.

When I execute the command "vncviewer :1" on the Linux machine, things work fine. I can see desktop appear in a window.

From Mac OS X I am unable to connect to the Linux vncserver. The message I get is "The connection was refused by the computer"

I am able to SSH from Mac to Linux so there is connection between the two computers but VNC won't work.

Can someone please help me save this issue. I have searched the web but found nothing that worked thus far. Thanks!

Here is the message from the vnc log file.

Xvnc TigerVNC 1.1.0 - built May 11 2016 13:01:55
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11704000, The X.Org Foundation


Tue Jan 24 10:03:36 2017
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      Listening for HTTP connections on all interface(s), port 5801
 vncext:      created VNC server for screen 0
GNOME_KEYRING_SOCKET=/tmp/keyring-jWrQoB/socket
SSH_AUTH_SOCK=/tmp/keyring-jWrQoB/socket.ssh
GNOME_KEYRING_PID=7644
gnome-session[7629]: WARNING: Could not launch application 'linc-cleanup-sockets.desktop': Unable to start application: Failed to execute
 child process "/usr/bin/linc-cleanup-sockets" (No such file or directory)
Failed to play sound: File or data not found

(polkit-gnome-authentication-agent-1:7668): GLib-GObject-WARNING **: cannot register existing type `_PolkitError'

(polkit-gnome-authentication-agent-1:7668): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed
An instance of nm-applet is already running.
Dropbox isn't running!
Dropbox is already running!
Initializing nautilus-dropbox 2015.10.28
(null):  Warning no default label for /home/amit/.gvfs
Failure: Module initalization failed

** (gnome-panel:7657): WARNING **: panel-applet-frame.c:1288: failed to load applet OAFIID:GnoteApplet:
(null)
Amit
  • 113
  • 1
  • 1
  • 5
  • 2
    This Q is not about programming as defined for StackOverflow. It **may** be more appropriate on the S.E. related sites http://SuperUser.com OR http://apple.stackexchange.com (AskDifferent) . Use the `flag` link at the bottom of your Q and ask the moderator to move it there. Please don't post the same Q on 2 different sites. Please read http://stackoverflow.com/help/how-to-ask http://stackoverflow.com/help/dont-ask and http://stackoverflow.com/help/mcve before posting more Qs here. Good luck. – shellter Jan 24 '17 at 16:37

1 Answers1

6

You can tunnel the VNC connection through SSH by using local port forwarding.

To start the port forward:

ssh -NTf -L 5901:localhost:5901 user@linux_server

Then point your VNC viewer at localhost.

vncviewer localhost:5901
Condor
  • 86
  • 4
  • 4
    To the downvoter for this answer: how can I improve it? – Condor Jan 25 '17 at 22:41
  • I would say that even though you provide an alternative solution, your answer doesn't answer the question that was asked. – haventchecked Jan 20 '22 at 16:20
  • If you have a better solution, please let me know. – Condor Jan 24 '22 at 11:48
  • It's just that your approach provides an alternative method for establishing a route to the vnc server host, but it still does not solve the problem of the host refusing the connection. In my particular case, I receive the same error as the OP no matter if I connect directly over my LAN or tunnel over SSH (over my LAN). I didn't downvote, but you specifically asked for feedback as to why someone may downvote. – haventchecked Jan 24 '22 at 19:16
  • Fair enough, and thanks for the explanation. I'm not sure if it's also true for CentOS boxes, but on Fedora I've seen that there's a firewalld daemon running there (so not just netfilter/iptables). It blocks incoming traffic by default. Maybe that's worth looking into, but I can't say for sure - I don't use CentOS myself any longer. – Condor Jan 28 '22 at 13:22