How do you copy and paste into the console?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

32 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.

  • Geez. Thanks for this. This worked for me. I used ‘wget’, but with the same results.

  • What a simple yet ingenious solution to counter DO’s archaic console! wget worked too :)

  • THANK YOU for this simple, elegant solution

  • Thanks, saved a lot of hassle.

  • To avoid scripts that don’t work or having to use DropBox (for security reasons):

    1. Login to the console on digitalocean website.
    2. Type sudo nano /etc/ssh/sshd_config
    3. Change PasswordAuthentication from “no” to “yes” and save the file
    4. Open a terminal on your computer and type ssh username@[hostname or IP address] or if on a Windows box use PuTTY for password login making sure authentication parameters aren’t pointing to a private key
    5. Login with password
    6. Type sudo nano ~/.ssh/authorized_keys
    7. Paste public key text here and save the file
    8. Type sudo nano /etc/ssh/sshd_config
    9. Change PasswordAuthentication from “yes” to “no” and save the file
    10. Log out and attempt to log back in (if using PuTTY make sure you set up auth parameters to point to your private key)

    Since the public key is now safely in the authorizedkeys file, you can use the console on the digitalocean website to troubleshoot if you are still having issues (like permissions or sshdconfig settings) that may still be locking you out.

  • Great solution, thanks!

    Just an FYI that Dropbox seem to have changed their policy… You can no longer publicly view a .pub file. Neither can you view a file without an extension. At least, I can’t so I presume it’s the same across the board.

    Couldn’t work out why CURL wouldn’t work - until I loaded the Dropbox URL in a browser to check (probably should have done that anway).

    I just changed the Dropbox file extension to .txt and it worked OK.

  • This is freakin’ brilliant! I’m happy to send you some beer money for this! :-)

  • I also found you can use wget to download a file from dropbox. So you can also use this approach.

    wget ''
    cat FILE-NAME.TXT >> .ssh/authorized_keys

    The important difference is the presence of dl=1 at the end of your dropbox link.

  • This is 100% the right work around to the copy/paste console problem. Thanks for the help.

  • My dear Sir, You saved my day! :)

  • Best answer. I got a new droplet without login but had no way to access it. Thank you for 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.

Hi, I have developed the following script based on another one, i lost its link

What I did is that I made it so it sends the whole text/cmd in one go also I added the ability to send line breaks when typing “\n” into the text, finally I made it so click enter at the end of each command.

The script is in a bookmarket format, just create a bookmarket and paste the following script into the address field

javascript: (function () {
    var s = prompt("Enter text to be sent to console, (This wont send the enter keystroke)");
    s = s.replace(/\\n/gi, String.fromCharCode(13));
    var t = s.split("");
    var i = [];
    function f(character) {
        var code = character.charCodeAt();
        var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1;
        var shift = XK_Shift_L;

        if (needs_shift) {
            key(shift, 1);
        key(code, 1);
        key(code, 0);
        if (needs_shift) {
            key(shift, 0);
    function key(keycode, down) {
        i = i.concat(RFB.messages.keyEvent(h(keycode), down));
    function h(e) {
        switch (e) {
        case 13:
            return XK_Return;
            return e;
  • This worked great for me. thanks! just be sure to run the console in a separate browser window and refresh the window after you create the bookmark.

  • Seems to work in my specific case, thanks mate!

    ps. What won’t work yet it’s that bloody Console, which is crap. But at least now I can copy/past things…

  • Even DigitalOcean got locked out of my VM, strange that it requires the Primary NIC to work in order to Power On/Off and Resize (This one I can understand the need for communication with Guest) but Power is Host Specific

    The only thing that worked was the Console, and of course thank’s to it being a lag-fest typing so many characters was impossible.

    Thank you for this!

such a bullshit console. i just wanted to add one more ssh pub key to our server. And i cannot login through the old ssh pub key. So what i have to do is,

  1. Open digital ocean panel click the access button then i will received a crazy long temp password like: 1hj2123h123h12h31lk2n31lk2n
  2. Open the console from digital ocean website, enter this bullshit password manually because do console didn’t support copy&paste.
  3. I will be required to reset the password, then that means i have to enter that password one more time!!!
  4. After reset, i try to edit the know_hosts file under ~/.ssh/, then once again, i cannot paste the ssh pub key. So i have to enter those pub key manually??? Can you believe it?
  5. Then i decided to switch to mac terminal, but i have to enable password login on remote server.
  6. Enable that password login support.
  7. Finally i add that pub key.

No copy and paste on console? Please add the feature, stop wasting our time!

I found a simple solution to this problem :

  1. Create a gist on github and copy the ssh key there on the gist. 2.Login to your terminal using user name and password then navigate to your ssh folder.
  2. Take a backup of your authorized_keys file and save it with different name.
  3. Now use wget command to fetch the file

  4. Use ls to confirm the name of the file you just downloaded.

  5. Append this new file contents to your authorized keys using cat command

    cat gistfile1.txt >> authorized_keys

    Done. You can now login using your public key.

  • A brilliant solution to an extremely ridiculous problem that Digital Ocean refuses to solve. I’m moving over to Azure next month. This has been an ongoing issue and I realize these might be edge cases but when their answer is to ignore the problem…

How is this still broken 4 years later. The only thing I should need a web-based console for is resetting passwords or adding SSH keys, both require being able to paste into the console. Shameful.

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()}();

Hey everyone,
I’m a product manager here at DigitalOcean and I wanted to send a quick update about this issue. We just released the ability to paste text into our Cloud console! Give it a try and let us know if there is anything else we can help with.

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

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.

I’m also finding this maddening- I need to add a new SSH key for the machine I’ve moved to, and there’s no way to easily move that information into the web console. Even creating a gist on GitHub creates a massive filename. It would be very useful to have a paste feature.

Same problem…

Create a gist with your public key, generate a short url, then download with curl and add it to authorized_keys:

curl -L >> ~/.ssh/authorized_keys

That solved the problem.

And just like that....I’m done with DigitalOcean.

No copy+paste? Tighten up boys.

The only reason I see to need to paste something in the console is if you are locked out of an ssh key authenticated server and need to paste a new ssh public key.
Why not just use the DO console to change PasswordAuthentication from “no” to “yes” in the sshd_config file, log in using your username and password in an ssh client, copy and paste the new key like normal, and then change the PasswordAuthentication parameter back to “no”?
I tried all of the above scripts and none resolved the Shift key problem like they said they did.

The above solution took less than 5 minutes to accomplish.

Reallllly annoying!

Just go to your mac terminal and type:

$ssh root@[ipaddress]

..and take it from there (DO jokers).

If you want a much faster experience - try Microsoft’s Edge browser. Try this : open 2 console windows - one in chrome and one in Edge. Enter a command in Chrome, watch the output in Edge almost immediately. Chrome stares at you for an entire minute before it coughs up stdout.

This works for me:

  1. I created a gist with my public ssh key
  2. From the web console I Cloned the created gist
  3. I moved and replaced this file into .ssh/ folder

Hello, all

The Copy/Paste functionality of our web console is a bit odd; the code backing it is custom due to the way the VNC window is implemented for accessing your Droplet. It isn’t a good idea, in my experience, to rely on the console for long copy/pasting like an SSH key.

The web console is intended to access your droplet in a case of emergency in order to sort out the issue. I will highly recommend to use a ssh-client in order to access and manage your droplet.

You can also check our docs on How to Connect to Droplets with SSH:

There are two options at the bottom of the doc:
Connect with OpenSSH
Connect with PuTTY

You can enable PasswordAuthentication for your Droplet by modifying your /etc/ssh/sshd_config file. Once set to Yes restart the SSH service and connect via an SSH client for a more stable connection. You can then modify your ~/.ssh/authorized_keys file to add the appropriate public key.

This should do the job for you as well.

The other option is to temporary enable the PasswordAuthentication from no to yes in order to access your droplet using password and then once you’ve entered your key to disable the PasswordAuthentication again. This way is considered more secure than uploading the key to a Dropbox in case you don’t have any other server to us.

  1. Login to the console on DigitalOcean website.
  2. Type sudo nano /etc/ssh/sshd_config
  3. Change PasswordAuthentication from “no” to “yes” and save the file
  4. Open a terminal on your computer and type ssh username@[hostname or IP address] or if on a Windows box use PuTTY for password login making sure authentication parameters aren’t pointing to a private key
  5. Login with password
  6. Type sudo nano ~/.ssh/authorized_keys
  7. Paste public key text here and save the file
  8. Type sudo nano /etc/ssh/sshd_config
  9. Change PasswordAuthentication from “yes” to “no” and save the file
  10. Log out and attempt to log back in (if using PuTTY make sure you set up auth parameters to point to your private key)

Hope that this helps!

  • Thnx, this works. But for the love of god can you (as in Digital Ocean) please fix this. I like Digital Ocean a lot. I use it for a few years now and most things work great. But this… this is just totally broken. It enraged me so much.

    • Hi, sanderlissenburg

      I’m glad that you’ve sorted this.

      As mentioned the functionality of our web console is a bit odd, the code backing it is custom due to the way the VNC window is implemented for accessing your Droplet.

      I will recommend to use it only in a case of emergency in order to regain the access using ssh-client.


Submit an Answer