Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove heroku ssh keys that don't have a name

The heroku docs mention how to remove ssh keys that have a name associated with them using heroku keys:remove:

https://devcenter.heroku.com/articles/keys

But I have managed to upload some keys that don't have a name and now can't find a way to delete them. The heroku keys:remove command expects a name to be specified.

Is there some other way to clear ssh keys associated with an account?

like image 824
Shannon K Avatar asked Aug 07 '13 12:08

Shannon K


1 Answers

You can always delete keys in the web interface on heroku. Or you use heroku keys:remove with the full public key (or even the first part of the public key)

$ heroku keys
=== [email protected] Keys
ssh-rsa AAAAB3NzaC...gegfp2Jw==
ssh-rsa AAAAB3NzaC...wZp2PJUw==

Two keys without names and I want to delete the second ending in 'Juw=='. To get the full key, use the -l flag.

$ heroku keys -l
=== [email protected] Keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAsH1GFnghrmFSQ+Dkg71VtYjkRJzlAdimXj9M7ELHCZom6A3e/9GefzvxosirTqiCbxNPaBXO/nX4ZHH/fT5L+YhmOhJ0FQDGhhCz3g3ElnG5+ve+Aj3adE3xY3FIdM9ZNKMth5ymgl+aBOIg7cJyBWVlL5wrMmayTpdUnVEhw0aiRrS4BegO+LZVZ+EO+IP+Jj3pXwZ4kUNnw82OY1+TWfVswwUdYAVFBRkSyptj50KbTGI8QeSJTviNwH8x76amkdZj1cbERUH3/1IUsGuVtYU8K3pcrZU/QySQo1/9HK2cM0zJgULnHuUgVSaZ3E1ivWAU6bk2YhXsGlgegfp2Jw==    
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1dk18DdzLS2B3Ops3VODW+YA8Lj4LC+hF9cS2uiTRXDcQali7UMT3jXAx/F5aADWRO5F3jJrcl2w6wWj6xd0Fubx9eV77NBbdGAWmHngqg23bQtJlw3uzErn94n4zhvxW/0pMuD3/TZ1SNRaWlE/q8TELAJJ8vJt2k8IfHH7FLWUOxQa0VlhG3nxfaVHHY+rLcjNmdyjXVYiKdko91jTmsTlT4HIpADTptyfEt0orUKPFZT8/ZgPEHEeNWEqZLGdPHc+knXwW3b7YfCSeUesYGwESZmNTo7opeQ2YIueDNhTRsPkZbRXzM1Qu1y0uv8jQqj1Y0uSQGsjQQwZp2PJUw==

You don't need to use the full key (but you can) just enough of the string so that is unique.

$ heroku keys:remove AAAAB3NzaC1yc2EAAAABIwAAAQEA1dk18DdzLS2B3Ops3VODW
Removing AAAAB3NzaC1yc2EAAAABIwAAAQEA1dk18DdzLS2B3Ops3VODW SSH key... done

Success!

$ heroku keys
=== [email protected] Keys
ssh-rsa AAAAB3NzaC...gegfp2Jw==
like image 156
Lukas Eklund Avatar answered Oct 14 '22 14:10

Lukas Eklund