Monday, October 19, 2020

SSH_ASKPASS

 

#!/bin/bash

hostname="127.0.0.1"
username="u"
password="p"

command='ls -l'

ask="/tmp/ask"

echo "echo $password" > $ask
chmod +x $ask

SSH_OPTIONS='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'

SSH_ASKPASS=$ask
DISPLAY=localhost:0.0

export DISPLAY
export SSH_ASKPASS

setsid ssh $SSH_OPTIONS $username@$hostname $command && echo '\n SSH OK\n' || echo '\nSSH PROBLEM\n'

No comments:

Post a Comment

Related post:

Related Posts with Thumbnails