40

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

karel
  • 13,706
Fisher
  • 757

12 Answers12

34

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 :)

Lion
  • 1,005
  • 2
  • 13
  • 26
10

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.

Fisher
  • 757
6

well this is what worked for me :

all i did is open VNC using "Run as administrator " and I was able to copy paste from windows 10 to Mac over VNC

Mike ASP
  • 161
2

If you're having problems pasting from windows client to a remote mac, do remember to use the appropriate keyboard shortcut - alt+v (translates to +v) instead of ctrl+v

This may be obvious for some, but less so for others

Phil
  • 201
  • 1
  • 2
  • 5
2

On your remote machine, append the text you want to a file:

echo "here is my text" >> ~/clip.txt

Then on your local machine, open a terminal window and ssh into your remote machine. Then run:

tail -f ~/clip.txt

The clipped text will show up in your terminal window whenever you append it to clip.txt remotely. There it can be copy and pasted locally, and you have an infinite copy buffer!

DarkDiamond
  • 1,919
  • 11
  • 15
  • 21
1
  • Create a shortcut of your VNC viewer
  • right click it, than properties
  • in the target, add -clientcuttext=1

example: "C:\Program Files\RealVNC\VNC Viewer\vncviewer.exe" -clientcuttext=1

Lrnd
  • 1,811
1

The other autocutsel answer was almost the answer for me, but not quite. What works for me is:

autocutsel -f -s PRIMARY

I'm running vnc4server 4.1.1+xorg4.3.0-37.3ubuntu2 on xenial and tigervnc-viewer 1.10.1+dfsg-3 on focal

gregrwm
  • 41
0

In windows:

cmd
C:\Program Files\RealVNC\VNC Viewer\vncviewer.exe

Run this way, you can copy from both sides.

Run this way,

C:\Program Files\RealVNC\VNC Viewer\vncviewer.exe -clientcuttext=1

from vnc server to windows client is available.

KAE
  • 1,919
0

Even after trying autocutsel, my vnc still would not work. My issue was that on XFCE terminalemulation has and issue with copy paste for some reason with vnc. When I switched to xfce-terminal my problem stopped.

Thanks,

Ediaz
  • 1
0

If you're using Royal TSX as VNC client, the default VNC plug-in setting "VNC (based on Apple Screen Sharing)" doesn't seems to be compatible with VNC clipboard sharing feature (at least, with TightVNC server from CentOS 7 repo). I had to change to "VNC (based on RoyalVLC)" or "VNC (based on Chicken)" to make it working (without ''autocutsel'' or ''vncconfig''). Make sure that you selected "Clipboard sharing" on connection Advanced settings when using RoyalVLC. I had problems using "space" key on Terminal so I decided to use Chicken instead.

0

For anyone looking for autocutsel for CentOS 7 (x86_64), it's available at http://dries.eu/rpms/autocutsel/autocutsel and can be installed through the following commands:

wget https://web.archive.org/web/20170608210220/https://driesrpms.eu/redhat/el7/en/x86_64/dries.all/RPMS/autocutsel-0.9.0-1.el7.rf.x86_64.rpm
sudo yum install autocutsel-0.9.0-1.el7.rf.x86_64.rpm
0

Copy and Paste files

One alternative approach would be with scp.

Considering the file StackExchange.csv in my Documents folder, one can send to the remote machine's Desktop as following

scp /Users/g/Documents/StackExchange.csv  <username>@<IP>:~/Desktop/

Copy and Paste text

If both machines are MacOS, one can also use

echo '123456789' | ssh <username>@<IP> pbcopy

This will send 123456789 to the clipboard of the remote machine.

Notes

  • For Linux clipboard options, the approaches in this thread might work as alternatives.