skip to Main Content
Copy-Paste Text To Your Linux Server Using Autocutsel

Copy-Paste Text To Your Linux Server Using Autocutsel

If you followed our guide on how to setup Monkersolver using Contabo and Debian linux, you may have noticed that you can not simply copy-paste text between your local desktop and remote server. In this guide we will show you the steps you need to take in order to enable this functionality.

First of all you will need to open an SSH connection to your server. In our original guide we recommend using the program PuTTY for this. Under Linux you can simply use the terminal. From the root user account, you will need to install the program autocutsel:

apt-get install autocutsel

Now that we have installed autocutsel, we will need to add an entry for it to our vnc configuration file. We will do this using the text editor vi from the command line:

vi /home/username/.vnc/xstartup

You will need to replace ‘username’ with the username you chose during setup. For most readers following our guide, this will be ‘vnc’. This command will open up the text editor from within your terminal window.

Interacting with the vi text editor works a bit differently than a traditional text editor, so you will need to follow the following steps in order to add the required lines to your file:

Edit and save your vnc configuration file:

Move your cursor to the third line ‘xrdb..’ and press ‘i’ on your keyboard. Next type ‘autocutsel -fork’, and hit the ‘Enter’ key once. (Tip: If you make a mistake, you can hit the ‘Esc’ key and type ‘:q!’, and try again.)

Now in order to save you will need to press the ‘Esc’ key and type ‘:wq’ (without brackets) and hit the ‘Enter’ key. This will save and close the text editor file:

Restart the VNC server:

In this next step we will restart vncserver. Don’t forget to save any important data first.

vncserver -kill :1

You may need to change ‘:1’ if you are not running vncserver on display output 1, or are running vncserver on multiple display outputs.

vncserver -geometry 1920x1080

Configure the resolution according to your needs.

Test that copy-paste is now functional:

Copy-paste for text should now work between your local and remote desktop. Simply copy-paste paste as normal using ctrl+c and ctrl+v. You can also right-click and copy-paste that way.

Leave a Reply

Your email address will not be published. Required fields are marked *