Bash & ssh problem
I'm trying to log in a remote server with SSH by a bash script.
I'm using sshpass package too. status="$(sshpass -p PASS ssh -o ConnectTimeout=10 USER@IP_REMOTE echo ok 2>&1)" I'm trying to obtain de vale "OK" in the var status. But always status is empty. Need help :P |
Doing it with "sshpass" involves a lot of risks, one of which is showing your password to anyone logged in on your system. They can just look with "ps" and see it.
I don't have "sshpass" and can use command substitution $( ... ) with "ssh" just fine using keys for authentication. So it might be interfering with that. Between the two problems, I'd recommend using keys for authentication instead. Code:
status="$(ssh -i /home/user/.ssh/some_key_rsa -o ConnectTimeout=10 USER@IP_REMOTE echo ok 2>&1)" |
All times are GMT -5. The time now is 07:49 PM. |