How to copy/paste text from remote system?

240,605

Solution 1

There will be a .vnc directory in your home folder. In this directory there will be few files named like <computer name>:<number>.extension
For example my laptop contains following two files in .vnc directory.

adnan-laptop:1.log
adnan-laptop:1.pid

The :1 in the above file names shows that the vnc server is running on display :1.

Now connect to your VNC server and from the connected session run vncconfig as follows:

vncconfig -display :1  

This will show a small window with clipboard related options. Check all the options and dont close the window. Now you should be able to copy paste from/to remote system.

Solution 2

  1. Install:

    sudo apt-get install autocutsel
    
  2. Run vi /home/b37399/.vnc/xstartup and add this line:

    autocutsel -fork
    

    like this:

    #!/bin/bash
    xrdb $HOME/.Xresources  
    autocutsel -fork  
    startxfce4 &  
    
  3. Restart vncserver

Solution 3

I use the following line in my login-script:

vncconfig -nowin&

Hope it works for you!?

Solution 4

It depends on the VNC client that you are using. If you are using RealVNC then open the VNC Viewer Properties dialog and, on the Inputs tab, turn on Share clipboard with VNC Server.

UPDATE:
Try this. Connect using vncviewer and run vncconfig within the remote window, check the options regarding the clipboard and then try.
enter image description here

Solution 5

I use Remote login with vnc-ltsp-config with GNOME Desktop Environment on CentOS 5.9. From experimenting today, I managed to get cut and paste working for the session and the login prompt (because I'm lazy and would rather cut and paste difficult passwords).

  1. Created a file vncconfig.desktop in the /etc/xdg/autostart directory which enabled cut and paste during the session after login. The vncconfig process is run as the logged in user.

    [Desktop Entry]
    Name=No name
    Encoding=UTF-8
    Version=1.0
    Exec=vncconfig -nowin
    X-GNOME-Autostart-enabled=true

  2. Added vncconfig -nowin & to the bottom of the file /etc/gdm/Init/Desktop which enabled cut and paste in the session during login but terminates after login. The vncconfig process is run as root.

  3. Adding vncconfig -nowin & to the bottom of the file /etc/gdm/PostLogin/Desktop also enabled cut and paste during the session after login. The vncconfig process is run as root however.

Share:
240,605

Related videos on Youtube

karthick87
Author by

karthick87

Updated on September 18, 2022

Comments

  • karthick87
    karthick87 over 1 year

    I used to access a remote system via VNC viewer, but when I copy some text from the remote system and paste it in my text editor(local system), nothing happens. Do I need to install any additional packages to achieve this task?

    Updates:
    There is no such option found in the Real VNC properties.

    Screenshot

    I just get the following output:

    karthick@karthick:~$ vncconfig         
    No VNC extension on display :0.0
    

    Updated:

    karthick@karthick:~$ vncserver
    
    Warning: karthick:1 is taken because of /tmp/.X1-lock
    Remove this file if there is no X server karthick:1
    
    Warning: karthick:2 is taken because of /tmp/.X2-lock
    Remove this file if there is no X server karthick:2
    
    New 'X' desktop is karthick:4
    
    Starting applications specified in /home/karthick/.vnc/xstartup
    Log file is /home/karthick/.vnc/karthick:4.log
    
    karthick@karthick:~$ vncconfig -display :1 
    vncconfig: unable to open display ":1"
    

    enter image description here

    • Oli
      Oli almost 13 years
      This is turning into a bit of a mess. Can you state somewhere what the setup is. What OS is the client? What OS is the server? What client and server software are you using on each?
    • karthick87
      karthick87 almost 13 years
      Client runs windows XP and the server runs ubuntu 10.10. And the client runs Real VNC and the server runs vncviewer. Do you need anyother information ?
    • Oli
      Oli almost 13 years
      vncviewer is not a VNC server (the clue's in the name :P)
  • karthick87
    karthick87 almost 13 years
    Pls see my updates in the question.
  • binW
    binW almost 13 years
    @karthick87: you are looking at VNC server's properties. Go to VNC viewer's Properties dialog
  • karthick87
    karthick87 almost 13 years
    No its not there in VNC viewer properties.Look @ the snapshot pls.
  • binW
    binW almost 13 years
    @karthick87: I have updated the answer. Plz try the vncconfig method. I believe it will work because it has always worked for me.
  • karthick87
    karthick87 almost 13 years
    Do you want me to type vncconfig in command prompt ?
  • binW
    binW almost 13 years
    @karthick87: run 'vncconfig' from command prompt or using Alt+F2. It will open a VNC Config dialog as shown in the image above. Check all the options and then try copy-pasting between local and remote systems.
  • binW
    binW almost 13 years
    @karthick87: did it help?
  • karthick87
    karthick87 almost 13 years
    I will try that tonight and let me update the status :)
  • karthick87
    karthick87 almost 13 years
    Pls see the output on my question..
  • binW
    binW almost 13 years
    @karthick87: can you plz tell us what command line are you using to run vnc server. Also plz run "ps ax|grep Xvnc" and add its output to the question. And plz remember to add @binW in the comment when you reply to me because otherwise I dont get notified.
  • karthick87
    karthick87 almost 13 years
    karthick@karthick:~$ vncconfig -display :1 vncconfig: unable to open display ":1"
  • binW
    binW almost 13 years
    @karthick87: what command are you using to run vnc server? have you checked .vnc directory in your home folder? does it contain files like karthick:1.pid?
  • karthick87
    karthick87 almost 13 years
    Pls see the updates in my question..
  • binW
    binW almost 13 years
    @karthick87: the output of vncserver says that "New 'X' desktop is karthick:4" so you should run "vncconfig -display:4"
  • karthick87
    karthick87 almost 13 years
    Now i am getting the following output, karthick@karthick:~$ vncconfig -display :5 No VNC extension on display :5
  • John Girata
    John Girata almost 11 years
    This seems to be the only solution where copy-and-paste is enabled at startup/boot/login and in the background. I'm running Red Hat Enterprise Linux 5 and could not get @Clausi's answer to work.
  • Alton XL
    Alton XL over 10 years
    At the end of the day, I ditched VNC for NoMachine NX.
  • Geek
    Geek over 10 years
    @binW For me inside the .vnc directory there are multiple entries with display 1. For example slc01ags:1.log and slc04lyo:1.log. So how do I specify which display 1while running the command vncconfig -display :1?
  • m3nda
    m3nda over 8 years
    Thank you. vncconfig did nothing this time, but I remember that adding it at the xstartup you can enable that feature. But using F8 I can enable or disable easily the direcction of the data, enabling only Remote->Local and never the opossite.
  • wsw
    wsw over 7 years
    The command vncconfig -display :1 works for me but why can't we close the window? Is there a way to set this once and for all?
  • Mithun B
    Mithun B over 6 years
    autocutsel worked for me, but not the "vncconfig -nowin &" or "vncconfig -display :1"
  • tryingToLearn
    tryingToLearn about 6 years
    For people reading this answer DON'T CLOSE THE WINDOW is the keyword. I missed that the first time and was unable to achieve the desired result.
  • kurdtpage
    kurdtpage almost 6 years
    Do you run this before vnc4server or after?
  • user889030
    user889030 almost 6 years
    not working on debian 8.10
  • Elia Weiss
    Elia Weiss over 5 years
    I get No VNC extension on display :1
  • Elia Weiss
    Elia Weiss over 5 years
    I get 'No VNC extension on display :1'
  • Hassaan
    Hassaan over 5 years
    this works for me on Debian 9
  • ckujau
    ckujau over 5 years
    As vncconfig appears to only be available with TigerVNC setups, the autocutsel trick helped - thanks!
  • Ruslans Uralovs
    Ruslans Uralovs over 5 years
    The fix applies to both copying to and from the remote system. Tested on Mac OS High Sierra / Ubuntu 18.04
  • nerkn
    nerkn over 5 years
    in my linux setup, I menu pop up but either copying didnt worked :( thanks for this menu hint, I wonder how did you find, there in the help menu they didnt show
  • Maghoumi
    Maghoumi over 2 years
    This is the only suggestion that worked for me, thanks! I was also using tightvncserver, and I had autocutsel -fork in my xstartup. But the clipboard was only working from remove to local machine (not the other way around). I installed vnc4server and added vncconfig -iconic & right after autocutsel -fork. Clipboard is now working bidirectionally!