Question

copy-paste doesn't work from your console

Posted February 4, 2017 18.7k views
UbuntuDigitalOcean

How the heck do I copy or paste anything from the web console? I’ve tried both Safari and Chrome. I’m trying to get ssh to work but I can’t copy/paste keys or get authorized any other way.

1 comment
  • Friends after ~40 min of frustration trying to copy-and-paste my original password on my first login from my Chromebook, I found an easy solution.

    1) Install the “Secure Shell” chrome extension
    2) run it, enter your droplet’s IP and username as “root”
    3) connect
    4) now for the trick: copy your password as it came on the email, and to paste it do not use CTRL-V but CTRL-SHIFT-V

    done!!!

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.

×
18 answers

I got it. I just needed to ssh in as root to set everything up.

  • @pjpark

    Glad you were able to get things working!

    For future reference, on most OS’s, root is the default user you’ll need to use to login initially. CoreOS is one exception.

    If you run in to any other issues, feel free to reply and I’ll be more than happy to help!

I still can’t copy and paste into the console. I need to update my authorized keys and what should take 2 minutes is taking more than an hour, with still no resolution in sight.

Edit: What I ended up doing was copying my idrsa.pub to a public server, wgeting it to my DO, and then yanking and pasting into `~/.ssh/authorizedkeys` with vim.

You know how I got this to work after not finding any workable solution?? Logged into console, edited ~/.ssh/authorized_keys using NANO and manually typed out the new ssh key…

Was locked out due to disabling password authentication and Permission denied (publickey).

On a Mac, wrote an AppleScript to type.

In Script Editor located /Applications/Utilities/Script Editor

tell application "System Events"
    set textToType to "ssh-rsa AAAAB..."
    delay 20
    repeat with i from 1 to count characters of textToType
        keystroke (character i of textToType)
        delay 0.6
    end repeat
end tell

Make sure to have ~/.ssh/authorized_keys already open in an editor and in insert mode waiting to type

Press play

After a 20 second delay (hopefully, enough time to change to the console browser window ready for the typing to start) this will type the text inside set textToType to emulating keystrokes

Same problem here: Reversed capitalisation; Cannot Copy/Paste.
Why am I having problems I had during the 1980’s on DEC Terminal on a 2400 baud modem?
Very frustrating.
Just trying to update my authorized_keys since SSH gives “Permission denied (public key)”.

this is still a problem for me in 2019. How is this like this?

2020, pasting anything into your default console results in different text. WTF digitalocean? Is this a joke?

@pjpark

If you’re on a MacBook / MacBook Pro, the best option is to use Terminal or Hyper – on Windows, it’s best to use PuTTy.

The console that’s available through the DigitalOcean Control Panel requires that you type in input – you won’t be able to CMD+V or CTRL+V it in.

There are several answers provided that will definitely work. I figured I’d also share mine.

  1. Enable ssh password authentication
  2. ssh using your normal terminal so you can copy and paste like normal
  3. Disable password authentication for security

Little more work but, it’s straightforward.

That’s the point. I can’t do any of that stuff because I can’t get ssh to work, and I can’t try to get the keys to work manually because I can’t copy or paste.

I’ve had to manually type in my local machines public ssh key from the DigitalOcean web console as well and it sucks. There’s no other way as far as I’m aware if you’ve disabled password authentication on your server.

Haha, Wooot! I did it! Finally logged in!!
“Achievement unlocked”

Here’s a python script you can use client-side to type for you…

#!/usr/bin/env python3
import subprocess
import time
import sys
text = "ssh-rsa tvHiU_VERY_LONG_KEY_sadf== you@gmail.com"

# 3 seconds to alt-tab to correct window after running
time.sleep(3)

for ch in text:
    # type out the text
    subprocess.call(["xdotool", "type", ch])
    # increase or decrease the time below to type slower or faster
    time.sleep(0.15)

Hi @pjpark, and others who reach this question from Google.

Regarding the question about pasting in the web console, you can use the script from here:
https://gist.github.com/croepha/7b53f211ae4be3c526c3 (by croepha)

Simply paste one of the versions into the browser developer console, and you’ll be prompted with a textbox to paste your text into it, and aftrer that press enter in the console.

You’ll see there also a version that binds the prompt to ctrl+shift+v or command+shift+v on keyboard.


There’s also a revised version of the gist:
https://gist.github.com/byjg/a6378edb420a1c654c5f27bb494ca1c8 (by byjg)

This one claims to include some improvements, and creates a “sendString” function which does the same action
After you paste it into the console, you can use the command this way:

sendString('command text to be sent');

You can easily create in your browser a bookmarklet from the minified version of each of the gists (with a “javascript:” prefix).

Hello

Se this video from Sebastien

Hope this may help!

Hey everyone,
I am 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.
Thanks,
Keith

  • Hey, I just tried and it still doesn’t work.

  • It only pastes a small amount of characters. Trying to paste a public key fails miserably.

  • Hi Keith,

    Copying and pasting still does not seem to work. It seems to be the main use case for this feature would be copying+pasting ssh keys to provide access.

    Is it possible to instead of working on this feature instead, add the ability to add root access ssh keys via the droplet gui manager on the main website? Kind of like how we manage our ssh keys on github.com.

    Just my 2c and thank you for your efforts!

How can DO be so widely recommended and yet in August of 2018 (September now) I get reverse capitalization when trying to paste in my SSH key (or anything for that matter) via the console. I just don’t get these guys, it’s one thing after another and yet everywhere you look says their stuff don’t stink. Aggravating, typing in the key by hand, this just isn’t worth it.

  • Totally frustrating. I had the same experience with reverse capitalization and the whole thing being truncated in half (4096 ssh key). I was able to paste my key in a “line” at a time. It seems the string buffer for the paste can’t handle much so you can’t overload it with too long a string. I pasted about 100 characters or less at a time into the console and it worked. Although for some reason missed the very first ’S’ but I was able to catch that.

    • This is the only suggestions that really worked. Thanks a lot. Unfortunately it is just at the end of the comments. There should be a way to vote good working suggestions

Hi everyone!

I had to login in recovery mode and didn’t want to copy the SSH key provided in the DigitalOcean console, so here’s what I did:

  1. I took a screenshot of the “SSH HOST KEY”
  2. Searched for: image to text online
  3. Found this site: https://convertimagetotext.net/imagetotextconverter.php
  4. Uploaded my screenshot
  5. downloaded the txt
  6. Got a perfect text version of my key

This took about 30 seconds.
Hope it helps someone else too, cause I was very glad I didn’t have to type in the whole key by hand : )))

ps.: I have no connections to the above site, maybe others work as well, but this is the one that worked for me.

Submit an Answer