How to enable text copy and paste for VNC

I am accessing a remote machine by VNC Viewer. Sometimes I find I can't copy and paste text from VNC Viewer.


None of the posted answers worked for me. vncconfig wasn't installed and other posts indicates that those fix only helped when c&p worked in the past. This was not the case for me on a fresh machine.

Using tight vnc server on a Raspberry Pi 3, I had to install autocutsel:

sudo apt-get install autocutsel

add the following line to ~/.vnc/xstartup:

autocutsel -fork

My complete xstartup file now looks like this:

#!/bin/sh

xrdb $HOME/.Xresources
# -solid grey gaves us a real mouse pointer instead of the default X
xsetroot -solid grey -cursor_name left_ptr
# Allow copy & paste when ClientCutText is set to true on the client side
autocutsel -fork

export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession

To apply the changes, restart VNC server:

vncserver -kill :1
vncserver :1 -localhost -geometry 1400x1050

Adjust the parameters according to your needs (display, resolution, ...) Now make sure that the property ClientCutText is set to true on your client. In real vnc viewer, open the properties and choose expert tab.

Now copy and paste works for me :)


If you can't copy & paste text, first check if you run "vncconfig &".

If you still can't, check terminal number n and run "vncconfig -display :n &".

Hope this helps.