copy and paste into console

May 2, 2016 20k views
Control Panels API

How do you copy and paste into the console?

19 Answers

I had a machine crash, and needed to setup another one with SSH access. I got the console login ok, but no way to paste my public key there. Just spent a whole day trying to find a way to do this.

My solution, finally was to put the public key on a public dropbox folder, then in the console, use:

curl 'https://dl.dropbox.....' > temp1
cat temp1 >> .ssh/authorized_keys

The attached JS snippet never worked for me, and I didn't have the patience to debug/improve the snippet (maybe that was a mistake since I wasted a whole day). Some versions drop characters, some changed them, some capitalize during the script paste action.

I might understand security issues which caused DO to decide not to allow copy-paste in the console, but they must supply an alternative way to upload an SSH key.

This issue is from 2013. It's about time DO solved this.

What I can share is how to paste command lines in the console.

  1. Copy the console URL and paste it to a new window.

  2. Open Developer Tools then click Console tab

  3. Copy and paste the codes below. Taken from stackoverflow

    var sendString = (function(rfb, force, sendDelay) { 
    sendDelay = sendDelay || 25;
    var _q = [];
    var _qStart = function() {
    var chr = _q.shift();
    if (chr) {
      setTimeout(_qStart, sendDelay);
    var _qStop = function() { _q.length = 0; };
    var fn = function sendString(str) {
    str = str || '';
    var chr;
    for (var i=0; i < str.length; i++) {
      chr = str[i].charCodeAt();
    if (rfb.sendString && true !== force) {
    console.warn('rfb.sendString not installed because it already exists.  Use force if you\'d like');
    else {
    rfb.sendString = fn;
    return fn;
  4. On the same console type sendString("Commandline to be pasted in the console")

NOTHING works on Digitalocean anymore. YOU can't copy paste, the console window is NOT scrollable with FF, Safari and Chrome. SSH Login from droplets don't work evenso pinging is good, DIGITALOCEAN GETS WORSE AND WORSE. They changed, they know have incompetent staff, wrong people in charge for Keytechnology, trying to optimise cost structure etcetera. The divers issue atm with DO makes me run away. I think it will not get better but more worse in future...

  • This is very irritating as I have long passwords stored in my password manager. Not going to type those in manually, so the console is kind of useless to me.

Let's try to REQUIRE DIGITAL OCEAN to change it's UGLY interface: no one works today without copy/paste.

To add your SSH key via copy & paste from your local terminal to your console - to establish the SSH connection - as explained. You need to copy the console window URL (at the top of the pop up browser frame) then add this URL to a new tab in your chrome browser - then in your chrome browser go to View>Developer>Developer Tools>Console & enter this minimised script (below) - which will enable you to PASTE your copied SSH key into the console no problems. As per answer on github

!function(){function t(){function n(t,e){s=s.concat(RFB.messages.keyEvent(t,e))}var o=e.shift(),s=[],i=o.charCodeAt(),c=-1!=='!@#$%^&*()+{}:"<>?~|'.indexOf(o),r=XKShiftL;c&&n(r,1),n(i,1),n(i,0),c&&n(r,0),rfb.sock.send(s),e.length>0&&setTimeout(t,10)}var e=prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");t()}();

To copy, right-click on console window and select, after Ctrl+C. Right click in console window and select Paste.

I'm assuming your are talking about the console on DigitalOcean's (your) panel but just in case terminal window was the subject of your request.


Should allow you to paste into a terminal window.

Hopefully Mr. Gimme Gimme got his answer here, thanks @Elizine from @johns325

This is a joke, there is no way to paste on the console?! :-/

This is utter rubbish, everyone needs cut n paste. I am disabled and find typing fast hard. I cannot even type my DO first password in its way to fast. Are DO willing to loose customers because there not disabled friendly! so annoyed.

Yeah, that's really annoying.

The only way to bypass this is to use an external ssh client like putty. It allows you to copy and paste.

1) Enter the root password
2) Copy the password from your mail
3) Right click beside "password:"

Note, that you do not see the pasted password.

It seems DO wants us to use SSH keys instead passwords

The code by @mikaelvg works. Its a bit irritating to add the code in the begining, but after that you can just use the paste function kind of normally and it goes through. Its still better than typing all the code by hand. I wish digitalocean had a console similar to cloudways.

Anways For those of you who didn't figure it out, here is what you have to do. Click on the console link from the control panel of digitial ocean, it will be a separate window but inspector doesn't work there. So you will have to copy the link and paste it in a new tab in chrome. Then right click > inspect, inside inspector click on the console tab, and paste the code @mikaelvg shared.

Devs add this feature plz :-p

Hi. Easiest solution if you're a Chrome user is to add Secure Shell or Termius or FireSSH extension and access your server via one of these console. Copy Paste Cut work fine (same on Firefox).

****curl 'https://dl.dropbox.....' > temp1
cat temp1 >> .ssh/authorized_keys

  • I am using another solution.
    I create a private git repository and via this repo transfer/update authorised keys. Maybe it will be helpful.

Hi Dear,

well you should tell me how to login in the console this is not possible I
already did destroy lot of droplets, the password is just to made I cannot
write it always i says t me error and if I cannot copy and past it, how
should i do than???

Thanks for info

Kind regards

Sylvie Eymin

Digital Ocean, how can you make things so complicated?

  • You can't paste in console using your keyboard? Do you honestly believe this is normal?
  • You mentioned Putty. You don't have an updated tutorial that works. I've been trying to access a simple SFTP for 4 hours now and still didn't manage to do it following step by step your outdated tutorials

I've totally had it with DO at this point. I've spent 90 minutes so far just trying to log in. Between apt-get upgrade eating my sudoers file, 6-digit codes, having to reset my root, auto logouts after like two minutes, not being able to paste into the console, all of this having to coordinate with my client to check this email or that, how can you think anyone is going to tolerate this for long?

Also, since you can't see your password not pasting into the console, it's a little bit frustrating to find out after unnecessarily resetting your root password.

Have another answer? Share your knowledge.