Tag Archives: X11 Xsession

To enable clipboard sharing between tightvnc server and client,

First install autocutsel.

Now, you need to modify the file ~/.vnc/xstartup.

Add the following lines to it:

export XKL_XMODMAP_DISABLE=1
autocutsel -fork

The file finally looks like this:

#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
autocutsel -fork
/etc/X11/Xsession

You may need to install autocutsel

In Ubuntu (if that’s your client OS), you need an additional step in the client side. Press F8 in the vnc viewer, and choose Clipboard(Local->Remote).

2016-29-17_	Selection_001

For a KDE Desktop run via VNC,

On the server:

apt-get install kde-plasma-desktop tightvncserver xtightvncviewer

Debian Wiki states that for a full KDE installation, one needs to do this:

aptitude install ~tkde-desktop

For LXDE:

apt-get install task-lxde-desktop

Create a user:

useradd -c "Tightvnc user" -m -r -s /bin/bash vncuser
sudo -iu vncuser bash
unset XAUTHORITY
vncserver

Now, create a vncserver instance:

vncserver :1 -geometry 1356x758 -depth 16 -pixelformat rgb565

If you weren’t prompted for a password, set a password for vnc with:

vncpasswd

If you need to reset the server:

tightvncserver -kill :1

Now, edit the file: /root/.vnc/xstartup

Find the line:

gnome-session &

and replace it with:

startkde &

if you prefer kde.

For lxde, the file looks like this:

#cat /root/.vnc/xstartup
#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession
lxterminal &
/usr/bin/lxsession -s LXDE &

Optionally setup an alias in .bashrc, and assign:

alias startvnc='vncserver :1 -geometry 1366x676 -depth 16 -pixelformat rgb565'
alias killvnc='tightvncserver -kill :1'
#alias startvnc='vncserver :1 -geometry 1356x758 -depth 16 -pixelformat rgb565'

On Windows, install TightVNC, and connect to url: yourserverip:5901

To enable Copy Paste between Windows and the VNC instance, try this:
Add the following lines to /root/.vnc/xstartup before /usr/bin/lxsession -s LXDE & :

vncconfig  -nowin &
export XKL_XMODMAP_DISABLE=1
autocutsel -fork

The final file for LXDE now looks like this:

#cat /root/.vnc/xstartup
#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1

vncconfig  -nowin &
export XKL_XMODMAP_DISABLE=1
autocutsel -fork

/etc/X11/Xsession
lxterminal &
/usr/bin/lxsession -s LXDE &

Now you can copy something in Windows and paste into Tightvnc.