Unable to SSH into DigitalOcean droplet which was created by "docker-machine" command - ruby-on-rails-3

I have created a DigitalOcean droplet using docker-machine command. Now, I am unable to login from my local machine to droplet because my ssh key is not added to server.
I have used the following command to create droplet
docker-machine create --driver=digitalocean --digitalocean-access-token=MyToken --digitalocean-size=1gb --digitalocean-backups=true --digitalocean-ssh-user=root myapp
I created the droplet from my local machine. I have added my local access key to droplet as well but I am still unable to login.
I am using the following command to ssh
ssh root#droplet-ip-address
I have tried to access droplet from digitalocean console as well but it does not allowed me to copy/paste ssh key.
Is there any other way to solve this issue?
Please help me

You need to pass the --digitalocean-ssh-key-fingerprint parameter to docker-machine to tell it which SSH key to use.
See the documentation here for details.

Related

DigitalOcean Permission denied (publickey) when adding new ssh keys to an existing droplet?

Having issue adding new ssh keys to an existing droplet on Digital Ocean Ubuntu VM.
SSH key is added via Digial Ocean portal via browser.
When added SSH key first time from local Ubuntu machine it is working fine.
Next time trying to add SSH from MacOS machine, and unable to login even though 2nd SSH key was added successfully, and keep getting Permission denied (publickey) error.
Checking on the remote Ubuntu droplet nano /etc/ssh/sshd_config can see PubkeyAuthenthication yes
There seem to be an issue with Digital Ocean web portal when adding 2nd SSH key. The portal show there are 2 SSH keys (Settings\Security\SSH keys).
However, checking authorized_keys file (nano .ssh/authorized_keys), only the 1st SSH key was there and the 2nd SSH key was not found.
Work a round fix was to login the Ubuntu server/droplet (using the working local Ubuntu machine for my case), and manually add 2nd SSH key (for MacOS machine) to authorized_keys file.
Server/Droplet Ubuntu:
nano .ssh/authorized_key
MacOS local machine:
cat .ssh/id_ed25519.pub ( I used ed25519 type in this instance, change to whatever yours pub key is).
Paste the SSH pub key to authorized_key file.
Reload ssh on Ubuntu server/droplet: systemctl reload ssh
make sure that the content of your public key corresponds to that in ~/.ssh/authorized_keys

VitrtualBox Connection to GitLab by using SSH keys

I'm stuck with a little ssh problem. I'm working with a Windows10 which has its pair of ssh keys generated via PuttyGen (rsa) by using domain's mail. I use this pair to connect via Ssh to my GitLab repository and all works fine.
I decided to create a Ubuntu VM via VirtualBox on the same machine, then I generated a new ssh keys pair into the VM using
ssh-keygen -t rsa -C "my.email#example.com" -b 4096
with the same mail of windows10's domain. After that I added this new public key into my GitLab account. However, when I test this new pair of keys via
ssh -Tv git#gitlab.com
where "gitlab.com" is my gitlab repository, I receive, along with some debug messages (which don't contain any useful information)
Permission denied (publickey)
Now, my question is as follows:
is there something that I should do differently as usual to setup a new pair of SSh keys into a VirtualMachine which use the same network of the Host machine? Or, theoretically, should it work fine just as I did?
Thank you
EDIT: I've also tried to copy the same VM SSH keys into my Windows machine, replacing the old one, and they works. So it's not a generation key problem, I think it's really a problem of VirtualBox or Virtualization in general, any help?

Permission Denied (public key)

I'm running a google cloud instance. I'm able to successfully connect to the instance via ssh.
But I'm not able to do the port forwarding to my localhost.
Here's the command I used:
ssh -L 16006:127.0.0.1:8080 username#instance_external_ip
When I run the above command , I get the following error
The authenticity of the host cannot be determined.
username#instance_external_ip : Permission Denied (public key)
How to solve this problem?
I found the answer for this question. The problem I had was that the server did not know the ssh keys. So, I did the following and it worked.
I deleted all the ssh keys in the my local machine and connect to my gcloud instance using the following command. gcloud command creates the ssh keys automatically and it transfers to the cloud ssh keys automatically. So, no need to manually copy paste the keys.
gcloud compute --project "project_name" ssh --zone "zone_name" "instance_name"
After this I connected to my instance using ssh. Before doing if you try to ssh tunnel , as the server won't be aware of the localhost, it will say permission denied on running ssh -L .....
Therefore, instead of directly connecting through ssh -L ... , connect along with ssh-key file stored in .ssh directory. Use the following command.
ssh -i ~/.ssh/google_compute-engine -L <ur localhost port number>:127.0.0.1:<remote_host_port> username#server_ip

Can not ssh into openshift

I am using ubuntu 12.04 LTS , trying to ssh login into my openshift gear. But It's not working, no error/success notice showing up after ssh command.
I have tried it by ssh *login-keys* as instructed in my openshift account. When execute this command rhc sshkey list , I got this
`default (type: ssh-rsa)
----------------------- Fingerprint: **some fingerprint ** Available: true
You have 1 SSH keys associated with your account. `
What can I
Try running the rhc setup command, it's possible that the wrong public key got added somehow, or maybe from another computer you added another key? You need a public key for each private key that you are using (usually a different one on each computer)

Amazon AWS EC2 Instance - Can't connect with SSH

This shouldn't be this hard. I cannot connect to new AWS EC2 instance via SSH clients. I am connecting from a Win 7 box.
Instance OS: Debian 6
AMI: debian-squeeze-i386-20121119-e4554303-3a9d-412e-9604-eae67dde7b76-ami-1977f070.1(ami-a121a6c8)
User: tried root and also ec2-user
Using .pem keypair that AWS generated and I downloaded
Confirmed security group and Key Pair Name on instance
SSH port 22 is OPEN: Nmap says so and Telnet gets a welcome reply
Using 3 different clients: all clients connect ok
PuTTY replies: Server refused our key
MindTerm Java browser add-in replies: Authentication failed, permission denied
Bitvise SSH replies: Attempting 'publickey' auth; auth failed;
Rebooted instance, wash, rinse, repeat...
REBUILT new instance and new keypair, wash, rinse, repeat...
Connecting isn't the issue. Why would the instance not accept the .pem file as the password? Is there an additional step I am missing? I followed EVERY frigging guide I could Google. AWS support is a joke. stackoverflow to the rescue...
TIA.
According to the debian wiki which has documentation on the AMI you are using, the username you need to use to login is 'admin'.
I have had many issues with connecting to EC2 via ssh.
ssh -i the-keypair-filename root#yourdomain.com
- Keypair file must be in same directory.
- I just used terminal to connect.
Make sure you generate or assign the keypair when launching the instance.
Also you can verify the keypair you have set in the AWS Management Console, this is done by selecting the running instance and then looking for "Key Pair Name:".
I hope this is helpful.
My problem was that I didn't add a volume that was expected in the fstab file so the server didn't start fully and the sshd daemon wasn't running.
Check with:
telnet HOST 22
Check the server logs to make sure it starts properly before you waste lots of time like I did.
Amazon Linux AMIs that use ec2-user password are listed at the bottom of this page.
http://aws.amazon.com/amazon-linux-ami/
Check that you are using one of those if trying to use ec2-user, or check the documentation for the AMI you are using.
Teri
Try using the "admin" username and ignore the username suggested by Amazon.
I had the similar problem and I have solved the issue by following approach.
1) Edited the knife.rb file in my chef folder i.e. :\Users\Administrator\chef-starter\chef-repo.chef\knife.rb as bellow:
knife[:aws_access_key_id] = "xxxxxxxxxxxxxxxxxxxx"
knife[:aws_secret_access_key] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
knife[:region] = 'ap-southeast-1'
knife[:aws_ssh_key_id] = "ChefUser"
knife[:ssh_user]="ec2-user"
In the command prompt, issued the command to create an ec2-server:
knife ec2 server create -r "role[webserver]" --image ami-abcd1234 --flavor t1.micro -G ChefClient -x root -N server01 -i H:\Chef-files\ChefUser.pem
Note that, even though I had given all the details in the knife.rb file, I had to give the .pem file path in coomand line through -i option. That solved my problem.
Check, if the solution of mine helps you.
Cheers,
Chandan
Logging in as "ubuntu" worked for me:
ssh -i private_key.pem ubuntu#myubuntuserver
Hope this helps
--Erin