summaryrefslogtreecommitdiff
path: root/scripts/check-keys
blob: ecdbfe64fc899183accd4e9cf27b8199d79ccad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

cd "${0%/*}/.."

host=$(uname -n)
if [ ! -d "hosts/${host}" ]; then
  >&2 printf 'no keys for host %s\n' "${host}"
  exit 1
fi

user=$(whoami)
if [ ! -f "hosts/${host}/${user}" ]; then
  >&2 printf 'no keys for user %s on host %s\n' "${user}" "${host}"
  exit 1
fi

diff -u --color "hosts/${host}/${user}" ~/.ssh/authorized_keys