Turn off strict checking of ssh keys

The great feature HostKeyAlias solves your problem: ssh -o HostKeyAlias=hostkeyalias__vm_2013-05-11_07 user@host creates an entry hostkeyalias__vm_2013-05-11_07 (without IP) in known_hosts. Of course, you could write a script or shell function which sets this value before each ssh call. Or you use a shell variable: HOSTKEYALIAS=hostkeyalias__vm_2013-05-11_07 ssh -o HostKeyAlias=$HOSTKEYALIAS user@host and change $HOSTKEYALIAS whenever the VM is … Read more

How can I remove an SSH key?

Note that there are at least two bug reports for ssh-add -d/-D not removing keys: “Debian Bug report #472477: ssh-add -D does not remove SSH key from gnome-keyring-daemon memory“ “Ubuntu: ssh-add -D deleting all identities does not work. Also, why are all identities auto-added?“ The exact issue is: ssh-add -d/-D deletes only manually added keys … Read more

How do I know if *.pem is password protected using ssh-keygen?

ssh-keygen -y -f myfile-privkey.pem If the key is password protected, you will see a “password:” prompt. The flags in this command are: -y Read private key file and print public key. -f Filename of the key file. As extra guidance, always check the command someone, especially online, is telling you to use when dealing with … Read more

How to get all fingerprints for .ssh/authorized_keys(2) file

Here’s another hack using plain bash without temporary files: while read l; do [[ -n $l && ${l###} = $l ]] && ssh-keygen -l -f /dev/stdin <<<$l; done < .ssh/authorized_keys You can easily make it a function in your .bashrc: function fingerprints() { local file=”${1:-$HOME/.ssh/authorized_keys}” while read l; do [[ -n $l && ${l###} = … Read more

What significance does the user/host at the end of an SSH public key file hold?

This field is a comment, and can be changed or ignored at will. It is set to user@host by default by ssh-keygen. The OpenSSH sshd(8) man page describes the format of a public key thus: Public keys consist of the following space-separated fields: options, keytype, base64-encoded key, comment. . . . The comment field is … Read more