ssh-agent - How to configure ssh-agent forwarding ?
Complete step by step tutorial on how to configure ssh-agent and ssh-agent forwarding
SSH Agent
SSH agent allows you to store ssh keys, and certificates on memory in unencrypted format. ssh-agent acts as an ssh key manager which allows you to use ssh keys without entering a passphrase every time you log in.
-
Enable ssh-agent
ssh-add -L
ssh [email protected]_machine
ssh-add -D
[email protected]:~$ eval "$(ssh-agent -k)"
Agent pid 182 killed
SSH agent forwarding will allow you login to a distant remote machine by forwarding the SSH keys stored on your local SSH agent onto a host to which you are connecting. For example, you need to connect to your production servers via your gateway server. Then you can add your SSH key to your local desktop ssh-agent and it will forward to your production servers via your gateway server. So you need not add your SSH key to your gateway server.
1. Create or open up the file at ~/.ssh/config
ssh -A [email protected]
[email protected]:~# ssh -A [email protected]
#Now you can ssh to your production server
[email protected]:~# ssh [email protected]_server
[email protected]_server:~#
You are successfully authenticated with the SSH key on your Desktop Machine.