diff options
Diffstat (limited to 'passh')
-rwxr-xr-x | passh | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -13,17 +13,22 @@ rm "$pipe" # remove file echo -n "Trying to get password from 'pass'... " if pass show "${PASS_PREFIX}$host" 2> /dev/null >&3; then echo "FOUND ('${PASS_PREFIX}$host'). Connecting..." - exec sshpass -d3 ssh -o StrictHostKeyChecking=accept-new $@ + set -x + exec sshpass -d3 ssh -v -o StrictHostKeyChecking=accept-new $@ else echo "not found. Trying pubkeys..." - ssh -o NumberOfPasswordPrompts=0 -o StrictHostKeyChecking=accept-new $@ + set -x + ssh -o NumberOfPasswordPrompts=0 -v -o StrictHostKeyChecking=accept-new $@ ok=$? + set +x if [ "$ok" -ne 0 ]; then read -rp "Connection via pubkey failed, password? " passphrase echo "$passphrase" >&3 echo "Connecting with passphrase..." + set -x sshpass -d3 ssh -o StrictHostKeyChecking=accept-new $@ ok=$? + set +x if [ "$ok" -eq 0 ]; then echo "It worked! Storing password..." echo "$passphrase" | pass insert -e "${PASS_PREFIX}$host" |