summaryrefslogtreecommitdiff
path: root/delkey
blob: a49c7b8e625fd3daecea3f95d3309b557a9dfab8 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
# Delete an authorized_keys entry. Specify the line number (from catkeys) to delete.

if [ $# -ne 1 ]; then
	echo "Syntax: $0 <line number>" >&2
	exit 1
fi

line_no="$1"

if ! [[ $line_no =~ ^[0-9]+$ ]]; then
	echo "Argument must be a number" >&2
	exit 1
fi

sed -i "$line_no"d "$HOME/.ssh/authorized_keys"

echo "New keys:"
"$HOME"/git-shell-commands/catkeys