1

I don't remember this being difficult last time I used vnc. This is what I've tried (I'm running fedora 21)...

First off, install a vnc server.

sudo yum install tigervnc-server
... y

Now to unblock the port. Not sure if vnc-server is correct here, but this page says it is. BTW, I initially tried firewall-config, but for the life of me couldn't get it to work via SSH with X forwarding.

> sudo firewall-cmd --permanent --zone=public --add-service vnc-server
> sudo firewall-cmd --list-all
# vnc-server not listed. damn. maybe if I try again, but pressing the keys harder
> sudo firewall-cmd --permanent --zone=public --add-service vnc-server
Warning: ALREADY_ENABLED: vnc-server
# ...? whatever...
> sudo firewall-cmd --zone=public --add-port=5900/tcp
# the port's there, that should do

I can understand why many give up and sudo service firewalld stop as a last resort. Now to run the vnc server,

> vncpasswd
Password: *
Verify: *
> vncserver
# seems to have started

Connecting remotely doesn't work. Even connecting locally doesn't work (unable connect to socket: Connection refused (111), although despite refused it's the same message when no server is running, so it probably meant something a little less like it found something to talk to in the first place).

For the moment I don't care about setting up a service to have the server start automatically. How do I do the basics?

[EDIT]
To connect I was simply typing the hostname into RealVNC Viewer on windows or running vncviewer localhost to test connecting locally.

1

OK, unlike some windows vnc servers I've used where the server shares the one desktop, there can be many virtual X desktops. Rather than have a single server that manages multiple desktops, there are multiple servers which each use a different port.

  • Port 5900 (:0) - local screen/login (not sure of correct terminology here)
  • Port 5901 (:1) - virtual desktop 1
  • Port 5902 (:2) - virtual desktop 2
  • ...

I guess a shorthand or maybe user friendly way to connect to these is adding the :0 or :1 etc. to the host name you're connecting to. This adds a number to the port before connecting.

Now without any arguments to vncserver, the default is to start a virtual display :1 (on port 5901) and by default vncviewer connects to 5900, which explains why I couldn't connect. A program such as x11vnc can share the main :0 desktop (e.g. x11vnc -ncache 10 -rfbauth /home/user/.vnc/passwd -display :0), but tigrevnc complains if you try vncserver :0.

TLDR:
I should have connected to display 1 or used port 5901:

vncviewer localhost:1
vncviewer localhost::5901

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.