Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm struggling with the concept of SSH Agent Forwarding.
This is what I've done so far:

  1. Create default identity local (ssh-keygen)
  2. Install the public key on bitbucket

Now I want to connect to a server like ssh myserver@myserver.be .

Then I would normally create a key on the server with ssh-keygen and again, copy the public key and add it to my bitbucket SSH keys. after that I can clone my SSH repository and pull/push to the bitbucket repository. But that is not the way to do it.

How can I make sure I don't have to create a key on my server? I've read many tutorials like this but I'm still struggling with the ssh agent forwarding.

UPDATE:

I've tried to do this tutorial but I'm already stuck at step 1. They say you need to add the following text to your config file (located at ~/.ssh/config):

Host example.com
 ForwardAgent yes

My config file looks like this before the first step:

Host bitbucket.org
 IdentityFile ~/.ssh/id_rsa

After the step it looks like this:

Host bitbucket.org
 IdentityFile ~/.ssh/id_rsa

Host mysite.be
 ForwardAgent yes

To try if it works you need to execute the following command on your server:

ssh -T git@bitbucket.org

Tried this but I'm getting the error Permission denied (publickey). on my server.

share|improve this question
    
Did you follow this tutorial ? – groxxda Jul 11 '14 at 13:38
    
I've tried to do the tutorial but I'm already stuck at the first step. Updated my topic with my results... – nielsv Jul 15 '14 at 9:49

Think you might be missing the [User] as in...

Host mysite.be
    User your_user_name_here
    ForwardAgent yes

Then in your console do...

$ ssh mysite.be

Doing it this way, the SSH client on your local machine will forward credentials for the remote user [your_user_name_here] to the remote server mysite.be when the latter is challenged by Bitbucket. Also ssh-agent is launched automatically on the remote.

share|improve this answer
    
Thanks for that advice. I have the same problem as the person who posted, but unfortunately this didn't help. – Brad Jul 22 '15 at 1:04

It looks like you may not have actually added the key to the agent..

If your local workstation is Linux then there's likely an agent running as part of your session you can examine it's contents with ssh-add -l

If the key hasn't been added to the agent you can also add it with ssh-add

After that when you ssh to mysite.be you should be able to see the key fingerprint listed when you run ssh-add -l

share|improve this answer

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.