34

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

karel
  • 13,390
  • 26
  • 45
  • 52
Fisher
  • 658
  • 2
  • 9
  • 19
  • Both the VNC server and VNC viewer need to support the shared clipboard feature. I assume you are using VNC Viewer (RealVNC), so make sure you are connecting to a VNC Server (RealVNC). – Joseph Jan 06 '19 at 04:41

10 Answers10

29

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
  • 835
  • 2
  • 10
  • 23
7

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
  • 658
  • 2
  • 9
  • 19
  • 2
    It's unintuitive that the vncconfig program that shows up is necessary for copy and paste. I closed its window thinking, "I don't need to change my settings." Then later I noticed that copy and paste wasn't working and wondered why. Running `vncconfig &` fixed it for me. – Brent May 13 '20 at 17:10
  • Where should you enter this command? On Windows? On Mac? – testing Aug 27 '20 at 10:27
  • Linux terminal, didn't try Mac. – Fisher Sep 02 '20 at 11:03
5

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
  • 151
  • 1
  • 1
1

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
  • 191
  • 1
  • 1
  • 5
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

Stephen Rauch
  • 3,091
  • 10
  • 23
  • 26
gregrwm
  • 41
  • 5
1

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,875
  • 11
  • 12
  • 19
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 11 '22 at 05:33
0
  • 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

Divin3
  • 1,775
  • 1
  • 14
  • 30
  • 1
    Seems it's one way copy. Copy text from VNC to Windows is working. But can't copy Windows text to VNC. Thanks! – Fisher Feb 08 '17 at 12:26
  • After remove "-clientcuttext=1", I can copy text from Windows to VNC. – Fisher Feb 23 '17 at 13:55
  • @Fisher ClientCutText - `Specify FALSE to prevent a connected VNC Viewer user pasting text to the VNC Server computer`so it must be set to true. There might be some other issue preventing you from copy/paste-ing. For example the copy/paste feature can be disabled from the vnc server to allow or disallow for different users. Maybe this will help: https://www.realvnc.com/docs/copy-paste-text.html – Divin3 Feb 23 '17 at 14:52
  • Now copy/paste from or to VNC is working perfect. So I don't think server has disabled copy/paste feature. Basically "-clientcuttext=1" can cause problem. Thanks! – Fisher Feb 24 '17 at 13:56
  • @Fisher - my theory is that the server could deny the copy/paste feature depending of the username that you used to connect – Divin3 Feb 24 '17 at 14:09
  • For my case, I'm using the same username. – Fisher Feb 24 '17 at 15:08
  • @Fisher so You said it works fine for now, if the problem appears again, leave a feedback and we can do some troubleshooting. – Divin3 Feb 24 '17 at 15:20
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,849
  • 8
  • 32
  • 48
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
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 12 '21 at 21:08
0

I have actually managed to solve this with a simple Python app that can automatically type and paste what you have copied into the VNC console. check out my video. Link >>>bit.ly/Pyautopaste

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 19 '23 at 09:12