Note: This description only applies to ubuntu 12.04 unity desktop. For other versions, see
Install vnc:
Sudo apt-get install vnc4server
Run the server:
Run vncserver directly after installation. For more parameters, see man vncserver. For the first operation, you must set a password to generate the configuration file in ~ /. The vnc directory has unlimited root permissions.
On another computer, you can connect to the desktop through remote vnc:
Example: vncviewer 1.2.3.4: 1 connect to the Remote Desktop
Configuration problems:
Default Configuration File ~ /. Vnc/xstartup is as follows:
#! /Bin/sh
# Uncomment the following two lines for normal desktop:
# Unset SESSION_MANAGER
# Exec/etc/X11/xinit/xinitrc
[-X/etc/vnc/xstartup] & exec/etc/vnc/xstartup
[-R $ HOME/. Xresources] & xrdb $ HOME/. Xresources
Xsetroot-solid gray
Vncconfig-iconic &
X-terminal-emulator-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
X-window-manager &
Possible problems with using the default configuration:
1. Use the default configuration. After you log on to the vnc desktop, you can only see the desktop background and a terminal. There is nothing else, for example.
2. A Counld not acquire name on session bus Error occurs during login, as shown in.
The following is my correct configuration to solve the above problem, with instructions:
Modified ~ /. Vnc/xstartup
#! /Bin/sh
# Uncomment the following two lines for normal desktop:
Unset SESSION_MANAGER
Unset DBUS_SESSION_BUS_ADDRESS
# Exec/etc/X11/xinit/xinitrc
[-X/etc/vnc/xstartup] & exec/etc/vnc/xstartup
[-R $ HOME/. Xresources] & xrdb $ HOME/. Xresources
Xsetroot-solid gray
Vncconfig-iconic &
X-terminal-emulator-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
# X-window-manager &
Export top_session = ubuntu-2d # This ubuntu-2d reference/usr/share/gnome-session/sessions/file name is set to a different value
Export GDMSESSION = ubuntu-2d
Export STARTUP = "/usr/bin/gnome-session = ubuntu-2d"
$ STARTUP
The final effect is as follows:
For vnc configurations in other ubuntu versions, use the default configuration.