Please follow the below mentioned steps to install VNC server in a Fedora 20 box.
Step 1 :
Install the Tiger VNC server package
[root@fedora20test ~]# yum -y install tigervnc-server
This will install the VNC server. Now we need to configure this.
Step 2 :
Now we need to copy the VNC server configuration file if you need to setup port-offset for VNC server. By default VNC server uses port 5900, so port-offset means we can run the service on a sub-port of the default port 5900. Say for example port 10, so actually VNC server will accessible on port 5910. When using the port-offset we can connect to the VNC server by just specifying the IP address:sub-port format. Eg:- 10.30.0.78:10
[root@fedora20test ~]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:10.service
Step 3:
Now edit the copied file and make changes as mentioned below.
The copied file will look the following.
[root@fedora20test ~]# vi /etc/systemd/system/vncserver@\:10.service [Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking # Clean any existing files in /tmp/.X11-unix environment ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' ExecStart=/sbin/runuser -l -c "/usr/bin/vncserver %i" PIDFile=/home//.vnc/%H%i.pid ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' [Install] WantedBy=multi-user.target
Replace all <USER> with the username that should be used in your environment.
I have used a user named “qatest”, so in my example this user is running the VNC server. So my file will look the below one. Please choose your user and change accordingly.
[Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking # Clean any existing files in /tmp/.X11-unix environment ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' ExecStart=/sbin/runuser -l qatest -c "/usr/bin/vncserver %i" PIDFile=/home/qatest/.vnc/%H%i.pid ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' [Install] WantedBy=multi-user.target
Step 4:
Now add exclusion in the firewall for the VNC connections to your server.
[root@fedora20test ~]# firewall-cmd --permanent --zone=public --add-service vnc-server
This will permanently add exclusion in the firewall for the VNC service.
Step 5:
Now setup a password for the VNC user.
So login as the particular user and do as below.
[qatest@fedora20test ~]$ vncpasswd Password : Verify :
Now you will be asked to enter the password twice, please do so. After this a new directory (.vnc) will be created under the home directory of the vnc user with a passwd file in it.
[root@fedora20test ~]# ls -l /home/qatest/.vnc/ -rw-------. 1 qatest qatest 8 Feb 20 17:55 passwd
Step 6 :
Now reload the systemctl daemon and start the VNC service.
[root@fedora20test ~]# systemctl daemon-reload [root@fedora20test ~]# systemctl enable vncserver@:10.service [root@fedora20test ~]# systemctl start vncserver@:10.service
This will create an xstartup under the .vnc directory of the specific user account.
[root@fedora20test ~]# ls -l /home/qatest/.vnc/ -rw-------. 1 qatest qatest 8 Feb 20 17:55 passwd -rwxr-xr-x. 1 qatest qatest 355 Feb 20 17:11 xstartup
Step 7 :
IF you need to set the resolution for the VNC desktop, please edit “/etc/sysconfig/vncservers”
[root@fedora20test ~]# vi /etc/sysconfig/vncservers
After editing please restart the VNC service.
Step 8:
Now connect from a Windows machine using the VNC client, say for example I have used TightVNC.
If everything goes right, you will get a password prompt as below.
That’s all, Done!!!…


A small correction in Step 4 – Add –permanent two preceding hyphens are important!
The correct command is:
firewall-cmd –permanent –zone=public –add-service vnc-server
——-
[root@localhost ~]# firewall-cmd –permanent –zone=public –add-service vnc-server
success
——-
Otherwise, you will get the following error in Fedora20, quite obviously 🙂
——–
[root@localhost ~]# firewall-cmd permanent –zone=public –add-service vnc-server
usage: see firewall-cmd man page
firewall-cmd: error: unrecognized arguments: permanent
[root@localhost ~]# firewall-cmd permanent –zone=public –add-service vnc-server
———
Rest of the article is OK and really appreciate the clear style of writing the instructions.
Thanks for the suggestion… 🙂
This article has made things a lot clearer but I am using Fedora 20 and have got stuck with this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=896648
Any response with a work around would be greatly appreciated. I don’t think anyone has a solution to it yet.
All I need is to load a Gnome session in the tightvnc viewer on the remote computer. I just get a message from gnome in the vncviewer saying: Oh no! Something has gone wrong. and then a logout button and after clicking it I get a black screen. This message seems to come from gnome itself.
I think the solution is to hack around with these two files but I don’t know how or which one to amend? Maybe the gnome session isn’t loading properly?
file 1: /home/user/.vnc/xstartup
file 2: /etc/systemd/system/vncserver@:10.service
Thank you.
don’t forget the antislash after the @
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@\:10.service
apparently the antislash is not needed for fedora 20 but previous
To connect to your desktop which is currently open, one should use x0vncserver (the normal tigervnc creates a new desktop, at least it did for me in Fedora with KDE.)
To accept connections to your current desktop use:
x0vncserver -rfbport=59** -PasswordFile=/home//.vnc/passwd -display :0
I am getting “Failed to issue method call: Bad message” when i issue the command : systemctl enable vncserver@:10.service
PLEASE HELP ME FIXING THIS
How would one integrate this with GDM? Currently tried:
——————————————————————————
yum -y install xinetd
cat <> /etc/xinetd.d/vnc
service vnc
{
disable = no
socket_type = stream
protocol = tcp
group = tty
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -query localhost -geometry 1440×900 -once -securitytypes=none
}
EOF
echo “vnc 5900/tcp # VNC and GDM” >> /etc/services
cat <>/etc/gdm/custom.conf
# GDM configuration storage
[daemon]
[security]
DisallowTCP=false
[xdmcp]
Enable=true
[greeter]
[chooser]
[debug]
EOF
systemctl enable xinetd
systemctl restart gdm
systemctl start xinetd
——————————————————————————
But then just get a blank/black screen when connecting to the server. Thoughts?
Is it possible to sync to the same session that’s on the VM console? I was able to setup the VNC server and kick it off and connect to it using my VNC viewer. But it’s not the same session as the VM.
Anyone else can’t start vncserver via systemctl anymore?
Issue: https://bugzilla.redhat.com/show_bug.cgi?id=1062968
Forgot to mention: after an upgrade from Fedora 20 to 21.
Pingback: Cannot get Tiger-Vnc To Work on Fedora 21 | DL-UAT
Hi, i did follow the steps, its working fine. but now i have one doubt. it allows a particular user, but how to login as root user from VNC?