summaryrefslogtreecommitdiff
path: root/unpenme
blob: 7a8dceae6d261073d610187392d302916a9d2cd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
FORREALS=-i~penme
set -e
if [ "$(id -u)" -ne 0 ]
then
        exec sudo -- "$0" "$@"
fi
sedprog='/ penme host key @ [0-9]+\.[0-9].[0-9]+\.[0-9]+/ d'
if [ "${0##*/}" = unpenyou ]
then
    [ "$1" ]
    ssh "$@" -- sed ${FORREALS} -E -e "'$sedprog'"  /root/.ssh/authorized_keys
else
    sed ${FORREALS} -E -e "$sedprog"  /root/.ssh/authorized_keys
    if [ -t 1 ]
    then
        diff /root/.ssh/authorized_keys${FORREALS#-i} /root/.ssh/authorized_keys
    fi
fi