ssh Cheat Sheet

View fingerprint of server ssh key
ssh-keygen -lf /etc/ssh/ssh_host_dsa_key.pub
ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub

View fingerprint of server key in known_hosts
ssh-keygen -l -F [hostname or IP address]

Remove server key from known_hosts
ssh-keygen -R [hostname or IP address]

Generate keypair (not sure why, but I prefer dsa – old habit, I guess)
ssh-keygen -t dsa
ssh-keygen -t rsa

Copy pub key to a server
ssh-copy-id username@server

2 thoughts on “ssh Cheat Sheet”

  1. Generate a key:
    ssh-keygen -t rsa

    Get passwordless access to a remote server using said key:
    ssh user@server “cat >> ~/.ssh/authorized_keys2” < ~/.ssh/id_rsa.pub

Comments are closed.