From d28d835f77a4c1ee8a8d220001d1e48442cfa0c1 Mon Sep 17 00:00:00 2001 From: Mikhail Golbakh Date: Wed, 27 Jul 2022 22:10:10 +0300 Subject: [PATCH] fix: add exit in authentication method check --- sshp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sshp b/sshp index 662bbf0..6ce364a 100755 --- a/sshp +++ b/sshp @@ -175,7 +175,7 @@ connect() { fi # Check if authentication should be via pubkey - if ssh -v -o BatchMode=yes "${ssh_params[@]}" "$dest" 2>&1 | grep -q "Server accepts key"; then + if ssh -v -o BatchMode=yes "${ssh_params[@]}" "$dest" 'exit' 2>&1 | grep -q "Server accepts key"; then ssh "${ssh_params[@]}" "$dest" else sshpass -p "$pass" ssh "${ssh_params[@]}" "$dest"