LightVNC

From Outrun Wiki
Jump to: navigation, search

1 LightVNC

LightVNC is a service for Red Hat (and compatible) Linux (version 6 and 7) that provides a minimal vnc service based on xdm + xfce (EL6) or lightdm + xfce4 (EL7) and tigervnc-server.

An introduction can be found here (outdated): Dirty Cache - Featherweight Linux VNC services

1.1 Installation

How to install:

  1. Make sure you have EPEL installed:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# or
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  1. Set up the Outrun Extras YUM repository (if you haven't already done this)
  2. Install the "lightvnc-el6" or "lightvnc-el7" package depending on the release:
yum install lightvnc-el6
# or
yum install lightvnc-el7
# Note that the wrong version will refuse to install
  1. If you run firewall (iptables) then open port 5900 and optionally 5901 and 5902
  2. Connect using a VNC client to <hostname|ip>
  3. Login as any non-root user (root also works on EL7)

1.2 Documentation

# Man pages:
man lightvnc
man lightvnc-setpass
man lightvnc-resolution

1.3 Persistent Desktop

A persistent desktop is a desktop that keeps your session alive if you disconnect.

# Setting the password for persistent desktops to 'secret':
lightvnc-setpass topsecret

# Check which vnc services are enabled
chkconfig | grep vnc

# enable lvnc-1 (this by default is the persistent desktop)
chkconfig enable lvnc-1

Now connect on <hostname|ip>:1 or <hostname|ip>::5901

1.4 Enabling or disabling desktops

Enabling/disabling persistent and/or nonpersistent VNC services:

# List vnc services
chkconfig --list --type xinetd | grep vnc

# Enable/disable vnc-0 on port 5900
chkconfig lvnc-0 off
chkconfig lvnc-0 on

# Same for (persistent) vnc-1 on port 5901
chkconfig lvnc-1 off
chkconfig lvnc-1 on

# Same for (non-persistent) vnc-2 on port 5902
# You could use this, for example, for a VNC server with different resolution
chkconfig lvnc-2 off
chkconfig lvnc-2 on

1.5 Changing the resolution

Changing the default LightVNC resolution:

Resolution is configured in the file /etc/sysconfig/lightvnc:

# LIGHTVNC[0]="-geometry 1280x1024"
# LIGHTVNC[1]="-geometry 1024x768"

The command lightvnc-resolution changes the resolution for the service. bash-completion works if installed.

# List standard resolutions
lightvnc-resolution -l
# Set resolution on vnc server 0 to 1280x1024
lightvnc-resolution -d 0 1280x1024 
# Set resolution on vnc server 1 to 1280x1024
# This may require killing the Xvnc listening on 5901 to read the new resolution
lightvnc-resolution -d 1 1280x1024

1.6 Known issues

  • Actually an XFCE issue, not LightVNC: On EL7 your desktop may have an icon for every file system, cluttering the desktop. Solution: Settings -> Desktop -> Icons -> Default Icons (uncheck "Removable Devices")
  • Logout may hang the session for a long time (infinite?). For non-persistent sessions, just close the vnc window. For persistent sessions you may have to kill the correct Xvnc session.
  • Network traffic between VNC server and client is unencrypted. Only use on secure trusted networks, or use an SSH tunnel or other VPN.