Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

to clone my bitbucket project,I changed the /.ssh/authorized_keys content by adding my bitbucket key and I am able to clone into my bitbucket,but after that I was not able to access my server at EC2 because I have deleted the whole content of /.ssh/authorized_keys and replaced with the key

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHMcFczzNgh1z97zMrpyV0b+NOU7yMSZBDuH5BhvG5XDNN2CaOiwNg2iVjIR2U5laGpGMV8VC5G2N2jevXnOFyXUoe7HUuCjGK9IeG0iBsuq8GWlqC6EY0H6JbTqQK94QJIgxB2Ib+NRGYpKiLkXBO7FR7ZIcv8cv+aZdLQgNDMQTHvcHvqK8N/swBgzW1qjp+hhnkJC5ozUhFFIDTJqxTN3v9bG4CV2qYpk8axfR003X7BRVkcFZsCSq56fJ9ueB+wnqnXSZ+9WDXDPcB8AQQQ+8jNTbAE/bgQbNpztssvsBdy8+zxe7LEMlfmM8vEoyE333jSZLtvF1q+upfxzZh

Now how do I access my server ? I have generated a key file using puttygen and replaced this code in public key and tried to login but it failed showing the error message

---------------------------
Error
---------------------------
Disconnected: No supported authentication methods available (server sent: publickey)
---------------------------
Authentication log (see session log for details):
Using username "ubuntu".
Server refused our key.

Authentication failed.
---------------------------
OK   Reconnect (2 s)   Help   
---------------------------

Note I access bibucket in windows, ~/.ssh/ has these contents config.txt,id_rsa.pub,id_rsa,known_hosts,personalid,personalid.txt and I didn't push into bitbucket after replacing text,but I cloned the private bitbucket repository

share|improve this question

1 Answer 1

If the key above is the contents of your authorized_keys file then you should use the private key that you use to access bitbucket e.g.

ssh -i /path/to/bitbucket/private.key user@ec2host.tld

You can recover the public key that you normally use to access the host using

ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub

where ~/.ssh/id_rsa is the path to your usual privater key.

Once you have recovered the key you could use ssh-copy-id to copy is to your ec2 instance

ssh-copy-id user@ec2host.tld

If you can't use that then copy the public key to the host and use

cat id_rsa.pub >> ~/.ssh/authorized_keys

In putty load your bitbucket private key into your ec2 session. Load the ec2 session then go to ssh->Auth, click on the Browse button and browse to and select the appropriate key.

You can recover the public key from your ec2 private key using puttygen. Load the ec2 private key into puttygen (File->Load Private Key) it will then display the public key

Public Key

which you can add to your ec2 authorized_keys file.

share|improve this answer
    
I access bibucket in windows ~/.ssh/ has these contents config.txt,id_rsa.pub,id_rsa,known_hosts,personalid,personalid.txt and I didn't push into bitbucket after replacing text,but I cloned the private bitbucket repository –  ReThink Mar 10 '13 at 13:49
    
@ThotaMadhuSudhanRao: Are you using putty on windows ? –  Iain Mar 10 '13 at 14:24
    
yes ,I am using putty on windows @lain –  ReThink Mar 10 '13 at 15:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.