Question

Can somebody explain copy / paste in the console?

Posted February 19, 2019 8.2k views
DigitalOceanUbuntu 18.04

I’ve never seen something like this.

I open the my Ubuntu console, it works (barely)

I tried to copy a SSH key via the clipboard, since nothing else works

It translates the lower case to upper case

This is what I’m copying:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAhv+3iCamfYpQlUBxsMcIsbSFZZcQADlu2ft6nibKukgdrt0wsC38yYMU9MzCk9R8t937E8TXTkmqvUH9djT/b6R

This is what the POS of a terminal copies:
SSH-RSA aaaab4nZAc1YC…

Can somebody try to explain?

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.

×
Submit an Answer
4 answers

It’s a joke isn’t it? 2020 boyzz and we can’t paste public key, but have to upload those to some public shit and curl them on server. RIDICOULOUS

Hello, all

Keep in mind that you can also put the key in a file hosted on any Dropbox or remote server and then you can just download it via the console using curl or wget

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. Restart the ssh service:
  • systemctl restart sshd.service
  1. 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
  2. Login with password
  3. Type sudo nano ~/.ssh/authorized_keys
  4. Paste public key text here and save the file
  5. Type sudo nano /etc/ssh/sshd_config
  6. Change PasswordAuthentication from “yes” to “no” and save the file
  7. 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!
Regards,
Alex

  • This Works. But however, SSH is a service run by the default ubuntu system. After step3, some latest systems might have to restart the ssh service. You can do this by the following commands.

    systemctl restart sshd.service
    
    systemctl restart ssh.service
    

    PS:this will restart the ssh service, you might have to log back into the system once you run each of these commands.

    • Hello, @pldeepesh

      Yes, that is correct. I’ll also recommend restarting the ssh daemon, I’ll adjust this in the listed steps. Thanks for pointing this out.

      Regards,
      Alex

Hi,

Are you using the console within the Digital Ocean dashboard (opens in the browser) or locally on your machine?

  • Yes

    Because was the only thing that worked. You must use SSH to login to the droplet, there’s no other way, several years ago you could use a password (I don’t know if its because of the image I selected), so there was no way to put a public key in the server other than trying to copy/paste, no FTP, no SSH, no nothing, because there isn’t a public key.

    In the end, I loaded the keys to my account, destroyed the droplet and created a new one with the keys

    I lost so much time trying to copy/paste with this bizarre behaivour. This doesn’t happen when I use PuTTY or any other mean

    • There will be times when you will need to copy paste again your ssh keys (like when you are changing your development machine).
      Try to follow the steps from answers in this question.
      https://www.digitalocean.com/community/questions/copy-and-paste-into-console

      Basically you will need to load up your public keys in a file and put it in a public location like gist or something like that and pull that file to your server and append it to your authorized_keys.

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

      My recommended method to get the key on the Droplet is over SSH itself. You can enable PasswordAuthentication for your Droplet by modifying your /etc/ssh/sshdconfig 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/authorizedkeys 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!
      Regards,
      Alex

This problem is so annoying, here’s how I got round it:

copy your ssh key into Notepad++,
select all text,
go to: Edit > Convert Case to > iNVERT cASE

Now copy and paste the inverted key into the Digital Ocean console, which will invert it back to the original.

Ugh.

  • If you don’t want to install Notepad++, I found this site will do the same. https://passwordsgenerator.net/Case-Convert/

    Copy text, click “Invert Case”, then paste the output in to droplet console.

    I also ran into issue of not being able to paste all at once, so I broke it into smaller chunks and pasted it that way.

    Yes this process was a pain. Has to be a better way.