Skip to content

Commit

Permalink
fix: add exit in authentication method check
Browse files Browse the repository at this point in the history
  • Loading branch information
DakEnviy committed Jul 27, 2022
1 parent 837f260 commit d28d835
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sshp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit d28d835

Please sign in to comment.