From 35c302a44526beba9b55b595a501c4dfd8604f86 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Thu, 7 Dec 2023 18:24:56 +0800 Subject: [PATCH] riot: dynamic port forwarding --- scripts/riot | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/riot b/scripts/riot index 10c7561..ec62f33 100755 --- a/scripts/riot +++ b/scripts/riot @@ -163,6 +163,18 @@ run_sshl() eval_or_echo $cmd } +# sshd +run_sshd() +{ + local port=$(get_free_port) + + SSH_OPTIONS="$SSH_OPTIONS -NC -D $port" + local cmd="$(prepare_ssh_cmd ssh)" + fmt_note "-->" $cmd + fmt_note " > please access localhost:$port" + eval_or_echo $cmd +} + # scp run_scp() { local src="$1" @@ -228,6 +240,9 @@ router() { test -n "$3" || fmt_fatal "no target address provided" run_sshl "$3" ;; + sshd ) + run_sshd + ;; scp ) test -n "$3" || fmt_fatal "no source path specified" test -n "$4" || fmt_fatal "no destination path specified"