Take the 2-minute tour ×
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.

How and where can I check what keys have been added with ssh-add to my ssh-agent ?

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

Use the -l option to ssh-add to list them by fingerprint.

$ ssh-add -l
2048 72:...:eb /home/gert/.ssh/mykey (RSA)

Or with -L to get the full key in OpenSSH format.

$ ssh-add -L
ssh-rsa AAAAB3NzaC1yc[...]B63SQ== /home/gert/.ssh/id_rsa

The latter format is the same as you would put them in a ~/.ssh/authorized_keys file.

share|improve this answer
    
[rahul@srv1~]$ ssh-add -l Could not open a connection to your authentication agent. –  Rahul Patil Dec 20 '12 at 11:11
    
@RahulPatil Are you running an SSH agent on that machine? Run this on the same machine as to which you've added the keys, not the remote one! –  gertvdijk Dec 20 '12 at 11:18
    
thanks my mistake –  Rahul Patil Dec 20 '12 at 11:27
    
You could run this command on the remote host if key agent forwarding is enabled. –  Patrick Mar 30 '13 at 19:58
add comment

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.