This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ssh [2012/03/29 19:10] k2patel [SSH Agent automation] |
ssh [2021/06/08 20:07] k2patel [Tips & Tricks] |
||
---|---|---|---|
Line 71: | Line 71: | ||
==== Tips & Tricks ==== | ==== Tips & Tricks ==== | ||
+ | == Show fingerprint of key == | ||
+ | <note important>You can use -v to print random ASCII Image</note> | ||
+ | |||
+ | <code bash> | ||
+ | # Using -E can specify MD5 has which mostly require to compare | ||
+ | ssh-keygen -lf .ssh/OLD/id_rsa.pub.old | ||
+ | </code> | ||
+ | OR | ||
+ | <code bash> | ||
+ | ssh-keygen -l -F ip.k2patel.in | ||
+ | </code> | ||
+ | |||
+ | It will print for all public key in single file if there is multiple key in it.\\ | ||
+ | Also, it is usefull in identifying MITM Attack by comparing against your known host.\\ | ||
+ | |||
+ | == Print fingerprint on login == | ||
+ | You can enabled printing of server key by setting following variable.\\ | ||
+ | <note tip>you can setup on any of following file /etc/ssh/ssh_config OR .ssh/config</note> | ||
+ | <code bash> | ||
+ | VisualHostKey yes | ||
+ | </code> | ||
+ | |||
+ | == Run Command from file Remotely == | ||
+ | Place all your command in xyz file. And run as follows | ||
+ | <code bash> | ||
+ | ssh -l k2patel nice.k2patel.in "`cat xzy`" | ||
+ | </code> | ||
+ | |||
+ | == Comment on public key == | ||
+ | You can control comment on public key during generation using following command. | ||
+ | |||
+ | <code bash> | ||
+ | ssh-keygen -t rsa -C "k2patel rsync to remote server xyz" -f .ssh/remote_xyz | ||
+ | </code> | ||
+ | |||
+ | == Temporarily disable ssh key forwarding == | ||
+ | This will disable key forwarding, while login with the key. | ||
+ | <code bash> | ||
+ | ssh yahoo.com -i .ssh/id_ed25519 -o IdentitiesOnly=yes -F /dev/null -l ketan | ||
+ | </code> |