Difference between revisions of "Configure vncserver on Ubuntu"
(→x11vnc to start with X.org) |
|||
(One intermediate revision by one user not shown) | |||
Line 15: | Line 15: | ||
sudo vi /etc/init/x11vnc.conf | sudo vi /etc/init/x11vnc.conf | ||
− | Creating an init script called | + | AUTOSTART: For Ubuntu |
+ | |||
+ | In Ubuntu (but not Kubuntu or Xubuntu) x11vnc needs superuser access, and needs the -auth /var/lib/gdm/:0.Xauth -display :0 options to be specified on the command-line. The argument value for the -auth option may be found previously with x11vnc -findauth. | ||
+ | |||
+ | You can run x11vnc before you've logged in by typing something like this: | ||
+ | sudo x11vnc -safer -localhost -once -nopw -auth /var/lib/gdm/:0.Xauth -display :0 | ||
+ | If you find a blank screen, check the x11vnc FAQ entry on headless servers. | ||
+ | |||
+ | Alternatively, you can add the following lines to the bottom of your /etc/gdm/Init/Default to have x11vnc start after your gnome login does (note that /etc/gdm/Init/Default does not exist on some Ubuntu devices): | ||
+ | |||
+ | # Start the x11vnc Server | ||
+ | /usr/bin/x11vnc <options> | ||
+ | |||
+ | AUTOSTART: For other Linux Distributions: | ||
+ | Creating an init script called x11vnc.conf in the /etc/init directory. Now add the following code to the script: | ||
start on login-session-start | start on login-session-start | ||
Line 21: | Line 35: | ||
end script | end script | ||
− | If you're using Ubuntu the | + | If you're using Ubuntu the x11vnc binary should be in the path /usr/bin/x11vnc. You can test to make sure it is installed and present in that path location by typing |
file /usr/bin/x11vnc | file /usr/bin/x11vnc |
Latest revision as of 20:31, 5 March 2015
A VNC server is a program that shares a desktop with other computers over a network. Vino is the default VNC server in Ubuntu Linux. x11vnc is another VNC server that uses tcl/tk based GUI and is not dependent on any one particular graphical environment. Krfb is the default VNC server in Kubuntu that is integrated with KDE. The useful tightvnc creates a completely new desktop, not attached to any actual screen. You won't see what is going on in the vnc session from the host machine. Because of this you may need to consider which you prefer and what you are trying to accomplish.
Ubuntu version 12.04 through the latest tested (14.04) the default VNC Server only lets you connect remotely once the user has logged into Gnome or XFCE. This is not useful for a remote headless system. To configure the VNC Server to start with the system and listen before a user is logged in locally the vncserver must be configured to start with the system services. For this it is the most simple to install x11vnc.
x11vnc to start with X.org
Obviously you need x11vnc installed before proceeding. Once installed...
apt-get install x11vnc
First set a master password.
sudo x11vnc -storepasswd /etc/x11vnc.pass
Now an init script needs to be created so the vncserver starts at boot.
sudo vi /etc/init/x11vnc.conf
AUTOSTART: For Ubuntu
In Ubuntu (but not Kubuntu or Xubuntu) x11vnc needs superuser access, and needs the -auth /var/lib/gdm/:0.Xauth -display :0 options to be specified on the command-line. The argument value for the -auth option may be found previously with x11vnc -findauth.
You can run x11vnc before you've logged in by typing something like this:
sudo x11vnc -safer -localhost -once -nopw -auth /var/lib/gdm/:0.Xauth -display :0
If you find a blank screen, check the x11vnc FAQ entry on headless servers.
Alternatively, you can add the following lines to the bottom of your /etc/gdm/Init/Default to have x11vnc start after your gnome login does (note that /etc/gdm/Init/Default does not exist on some Ubuntu devices):
# Start the x11vnc Server /usr/bin/x11vnc <options>
AUTOSTART: For other Linux Distributions: Creating an init script called x11vnc.conf in the /etc/init directory. Now add the following code to the script:
start on login-session-start script /usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log end script
If you're using Ubuntu the x11vnc binary should be in the path /usr/bin/x11vnc. You can test to make sure it is installed and present in that path location by typing
file /usr/bin/x11vnc
When you reboot the system the VNC Server should be running. You can connect remotely prior to a local user starting a desktop session, or afterwards. You can start a desktop session remotely via vncviewer. It will be a shared session. You will see the same thing and will be controlling the same desktop that the local user is using. There is a way to have it create a separate session, however, that is not covered here.
REFERENCES AND SOURCES;
TightVNC server
tightvnc is designed to be run from the command-line. To start it, type:
tightvncserver -nolisten tcp :1
To only allow local connections and automatically disconnect clients, start tightvnc by typing:
tightvncserver -nolisten tcp -localhost -nevershared :1
Then when your client is disconnected by the next client connecting, type:
tightvncserver -kill :1