I have a root access to VPS (centos 6). I have installed VNCServer using this guide line http://tournasdimitrios1.wordpress.com/2011/02/02/how-to-setup-vnc-server-on-centos-5-x-fedora-11/

Everything goes perfectly and server is running via termina. Now I am trying to connect to that server via vncviewer (mac os). but its giving me error

Connection refused (61)

I am providing only the IP address of the VPS, maybe I also needed port address? How to configure port on vncserver? or its something else?


I've just had this problem. I resolved it by explicitly stating the port number when connectin from the client. E.g.:

Hope this helps someone.


First, temporary disable iptables using this command:

service iptables stop

Now try to connect; if the connection was successful, then try to allow VNC default port in iptables.


To get this working I installed the VNC server, then added the following to the firewall:

iptables -I INPUT -p tcp --dport 5900 -j ACCEPT
iptables -I INPUT -p tcp --dport 5901 -j ACCEPT

Then in my VNC client I connected by including the port number in the IP.

There's no need to stop IPTABLES.


I noticed that the documentation has the following:

$ vncdo --help
Usage: vncdo [options] CMD CMDARGS|-|filename

Command line control of a VNC server

  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -p PASSWORD, --password=PASSWORD
                        use password to access server
  -s SERVER, --server=SERVER
                        connect to VNC server at ADDRESS[:DISPLAY|::PORT]

Notice the double colon, ::PORT So in my case, I was able to connect using:

vncdo -vs vncServerIP::5901  type "hello world"

(instead of vncdo -vs vncServerIP:5901)

(Also, the -v, verbose mode, was quite useful to see what was going on along with disabling any kind of security on the vnc server side)

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.