Forwarding your key using SSH Agent

Forward your key it is an easy way to connect to a host (host A) with your SSH key, and from there, to connect to another host (host B) using the same key.

Forwarding your key using SSH Agent on Windows

To access the server via SSH forwarding your key using PuTTY you must have it configured. Please, check the how to connect to the server through SSH using an SSH client on Windows section for more information on this.

Once you have your SSH client correctly configured, you need to enable the SSH Agent forwarding. For doing so, follow these steps:

  • In the "Connection -> SSH -> Auth" section, activate the "Allow agent forwarding" checkbox.

PuTTY forward agent

  • In the "Session" section, save your changes by clicking the "Save" button.
  • Click the "Open" button to open an SSH session to the server. The SSH session will now forward your key, you can check it by running the following:

       $ ssh-add -L
    

Forwarding your key using SSH Agent on Linux and Mac OS X

To access the server forwarding SSH keys, follow the steps below.

  • Open a new terminal window on your local system (for example, using "Finder -> Applications -> Utilities -> Terminal" in Mac OS X or the Dash in Ubuntu).
  • To access the server forwarding your key, you need to have the following information:
  • Run the following command to add the SSH key to the agent. Remember to replace KEYFILE with the path to your private key:

       $ ssh-add KEYFILE
    
  • Connect to the server using -A option, remember to replace SERVER-IP with the public IP address or hostname of your server:

       $ ssh -A bitnami@SERVER-IP
    
  • The SSH session will now forward your key, you can check it by running the following:

       $ ssh-add -L