diff options
| author | la-ninpre <leobrekalini@gmail.com> | 2021-09-02 13:01:18 +0300 |
|---|---|---|
| committer | la-ninpre <leobrekalini@gmail.com> | 2021-09-02 13:01:18 +0300 |
| commit | 12a23949a4de1ee98db8855520741494d3651062 (patch) | |
| tree | 5f5f0df9333476408a6c2f4ccfdf512e04d3fc59 | |
| parent | 195936b9cc5feae5aefacf941d9555b8b5c28e70 (diff) | |
| download | dotfiles-12a23949a4de1ee98db8855520741494d3651062.tar.gz dotfiles-12a23949a4de1ee98db8855520741494d3651062.zip | |
add script to remove localhost fingerprints
i use few vms and they are populating `known_hosts` file with their
fingerprints, and when i launch any other vm, ssh insults me that
fingerprint is wrong and bla bla bla. so, just a little bodge.
| -rw-r--r-- | bin/.local/bin/clean_local_ssh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/.local/bin/clean_local_ssh b/bin/.local/bin/clean_local_ssh new file mode 100644 index 0000000..54b67a9 --- /dev/null +++ b/bin/.local/bin/clean_local_ssh @@ -0,0 +1,17 @@ +#!/bin/sh -e + +_known_hosts="$HOME/.ssh/known_hosts" + +grep localhost "$_known_hosts" + +printf "remove these entries? [y/N] " +read -r REMOVE +case "$REMOVE" in + [Y|y]) + grep -v localhost "$_known_hosts" | tee "$_known_hosts.new" + mv "$_known_hosts.new" "$_known_hosts" + ;; + *) + exit 1 + ;; +esac |
