mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-07-07 09:20:30 +08:00
feat(riot): rm - remove host keys
This commit is contained in:
parent
b005624be2
commit
b02f249f68
27
scripts/riot
27
scripts/riot
@ -214,11 +214,33 @@ run_scp() {
|
|||||||
eval_or_echo $cmd
|
eval_or_echo $cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# remove host keys
|
||||||
|
remove_hostkey()
|
||||||
|
{
|
||||||
|
local key
|
||||||
|
if [[ -z "$PORT" || "$PORT" == "22" ]]; then
|
||||||
|
key=$SERVER
|
||||||
|
else
|
||||||
|
key="[$SERVER]:$PORT"
|
||||||
|
fi
|
||||||
|
ssh-keygen -R "$key"
|
||||||
|
}
|
||||||
|
|
||||||
# main
|
# main
|
||||||
print_help()
|
print_help()
|
||||||
{
|
{
|
||||||
fmt_info "usage: $0 <service> [command] [options]"
|
fmt_info "usage: $0 <service> [command] [options]"
|
||||||
echo "available commands: ssh (default), sshl (ssh -L), zssh, sftp"
|
cat <<EOF
|
||||||
|
available commands:
|
||||||
|
- ssh (default)
|
||||||
|
- tmux (run ssh in multiple tmux windows)
|
||||||
|
- sshl (ssh -L)
|
||||||
|
- sshd (ssh -D)
|
||||||
|
- zssh
|
||||||
|
- sftp
|
||||||
|
- rm (remove host keys)
|
||||||
|
- ping/ping6 (let the remote to ping the given target)
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
router() {
|
router() {
|
||||||
@ -279,6 +301,9 @@ router() {
|
|||||||
test -n "$4" || fmt_fatal "no destination path specified"
|
test -n "$4" || fmt_fatal "no destination path specified"
|
||||||
run_scp "$3" "$4"
|
run_scp "$3" "$4"
|
||||||
;;
|
;;
|
||||||
|
rm )
|
||||||
|
remove_hostkey
|
||||||
|
;;
|
||||||
* )
|
* )
|
||||||
print_help
|
print_help
|
||||||
fmt_fatal "unknown command: $2"
|
fmt_fatal "unknown command: $2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user