Score:0

Add ssh key to local ubuntu

cn flag

I have a ssh key and key.pub that I got from digital ocean for a vm I have for ubuntu.

I have a local ubuntu from which I want to copy files to the vm using scp. The problem is I can't get keys to be recognized on the local ubuntu for it to work. I put my DOUbuntukey and DOUbuntukey.pub into /etc/.ssh and into /home/tech/ssh but I am still getting:

ssh -v -i DOUbuntukey [email protected]
OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 134.122.115.5 [134.122.115.5] port 22.
debug1: connect to address 134.122.115.5 port 22: Connection timed out
ssh: connect to host 134.122.115.5 port 22: Connection timed out

How can I add my already existing keys to my local ubuntu? The files are already on my local computer but they are not configured for use to the local computer.

Thank you.

in flag
Have you confirmed that there is no firewall blocking the SSH connection? This may be either on the web server or in Digital Ocean’s network (if they use IP filtering for ports like AWS does).
user535733 avatar
cn flag
"*Connection timed out*" is not a key error. It's a network error.
mentalnoob avatar
cn flag
@matigo Digital ocean has ssh open by default when you are using ssh keys. user535733 - that is because it wasn't able to find the DOKey. Just beacuse I put it into /etc/.ssh doesn't mean its apart of the ssh_config file but I don't know how to add the key to the file
in flag
You need to be very specific with file locations: `ssh -v -i ~/.ssh/DOUbuntukey [email protected]`. Be sure that the file permissions are properly set to `600` as well.
mentalnoob avatar
cn flag
@matigo I think you are right. I am still doing some other testing I will be coming back to this but this makes alot of sense. I will give you an update tonight
Score:0
us flag

Check if port 22 is open for your IP or to the Internet (not recommended).
If it is open then try following steps:

  • Create .ssh directory at home (/home/tech/.ssh),
  • copy DOUbuntukey and DOUbuntukey.pub,
  • Create empty known_hosts file, and retry connecting to VM.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.