By PPSona
I have created 2 droplet, the first one is for production and second one is for testing, so I can connect to the first server/droplet that I have created using ssh key. but when I tried to connect to the second droplet/server, it said “Host key verification failed” how do I connect to the second droplet using my ssh key?
so I have 2 ssh key and two droplet.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi,
Do you have two public and private keys in some folder, right?
Can you configure a .config file in your ~/.ssh folder to connect multiples hosts in a simple command, example:
In your home directory (/home/my_user) look for a folder named “.ssh”. Haven’t? create:
mkdir .ssh
Navigate to the folder:
cd .ssh
Create a config file:
touch .config
Edit him with your preferred text editor:
nano .config
Put the code, something like this:
#HOST1
Host host_prod
HostName 100.100.100.100
Port 22
User ubuntu
IdentityFile ~/any_folder/private_ssh_file
#HOST2
Host host_test
Hostname 200.200.200.200
Port 22
User ubuntu
IdentityFile ~/any_folder/private_ssh_file
Check:
I have found my own solution, I tried to login to second server with password sent to my email and then copy my ssh key via terminal, and now I can log in in to two server at the time without password.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.