How can I copy and paste into console in digital ocean?
Asked Answered
D

4

15

The console in the digital ocean like this :

enter image description here

I try to copy and paste my username and password, but it does not work

I try ctrl+v and right click on the mouse. It does not work

How can I do it?

Disengagement answered 12/2, 2018 at 2:41 Comment(1)
DigitalOcean’s Droplet console allows you to paste content since August 14, 2018, as per their official release notes.Khajeh
B
25

I have the same problem. I needed to add ssh key to the existing droplet. So, best solution was to upload file to the droplet from dropbox and copy text.

Solution

On the authorized web console of your droplet or on the connected to your droplet local terminal execute code:

curl https://www.dropbox.com/s/*******/****?dl=1  -o temp -J -L
cat temp >> ~/.ssh/authorized_keys

Links

Use curl to download a Dropbox folder via shared link (not public link)

Bromley answered 6/10, 2019 at 16:15 Comment(2)
Alternatively, you can use Visual Studio Code. It can create, open, edit, and transfer files on the virtual machine from within the code editor like you would on your regular computer. It also doesn't have limitations like the droplet console. The droplet console can't scroll through its output, its window size is small, and doesn't expand when maximized, and it incorrectly formats pasted text.Adjunction
Link to tutorial: medium.com/p/44afcc954d38Adjunction
N
7

Alternatively, you can also upload your file to file.io and curl that in a more simple way.

file.io also deletes the file after access.

Step 1: Upload file to file.io
Step 2: Copy the generated link that file.io generates
Step 3: Curl the webpage and save it. (First command)
Step 4: Append it to the "authorized_keys" file in your .ssh folder.(Second command)

Commands to enter:

curl fileIOLink -o fileNameOnServer
cat fileNameOnServer >> authorized_keys

I believe this solution helps as it appears easier to simply upload to file.io since it does not require an account to use.

Nautical answered 28/12, 2020 at 22:36 Comment(0)
P
3

paste this code in console (left click on empty black screen in digital ocean console, then select Inspect - after that, choose the console tab):

!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=XK_Shift_L;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").split("");t()}();

it will open a prompt box, just paste the text you want to paste - and it will paste it on console.

Palindrome answered 30/7, 2018 at 9:49 Comment(1)
Answers like this that contain some "magic" text to be pasted into a console should be heavily annotated or explained. What is all of this stuff? Is it a fork bomb? Is it malicious? This answer is especially confusing because it uses the term "console" to mean two different things: (1) droplet console (2) browser javascript console.Procrustes
M
0

If you're like me and came across this search result in 2024, here are some things I discovered that might help others.

First, my purpose for copy/paste was to manually add an SSH key to my ~/.ssh/authorized_keys file. I connected to my Droplet through the recovery console, the same as the OP did.

The first major problem I encountered was that when I used paste on my Macbook (control + v) it wouldn't paste the correct text. It would start to, but by the end of the string it was completely wrong.

The second problem was that after doing that, everything was stuck in CAPS mode. I found this blog post (https://www.vishalon.net/blog/digital-ocean-recovery-console-stuck-in-caps-mode) that explained how to fix the issue, which is to type "reset" in lower case.

Ok, so the way I got around the text being wrong and incomplete was to take only smaller chunks of my key (118 characters at a time, to be exact), and instead of using the paste shortcut, I right clicked on the screen and selected "paste". I did this with every chunk until eventually the entire key was pasted in.

Hope that helps!

Mediacy answered 5/4, 2024 at 1:51 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.