.bashrc: add sshunlock for remote unlocking servers

This commit is contained in:
Peter Cai 2022-03-19 22:00:52 -04:00
parent 819e682918
commit f3fa702da1
1 changed files with 14 additions and 0 deletions

View File

@ -27,5 +27,19 @@ function sshscr() {
ssh -t $@ screen -RR -d
}
# Alternative SSH session for unlocking remote encrypted servers
# This requires a standalone known hosts file
function sshunlock() {
set -o pipefail
pass show "Misc/$2" | wl-copy
if [ $? -ne 0 ]; then
echo "key not found"
return
fi
ssh -o UserKnownHostsFile=~/.ssh/known_hosts_unlock root@$1 -t "zfsunlock"
echo "" | wl-copy
set +o pipefail
}
# Add local to path
export PATH="$PATH:~/.local/bin"