Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I created a simple bash script that runs fine on Ubuntu 18/20. Decided to port it onto PowerShell. I start PowerShell in Windows 10. Then type: ssh 192.168.1.56 This allows me to reach the target. (the key is located in /c/users/joe90/.ssh/)

On the other hand, the bash script does the same thing:

#!/bin/bash

ssh 192.168.1.56 

Yet, I keep getting this error: load pubkey "/c/Users/joe90/.ssh/mykey-xyz": invalid format

The only thing I was able to sort out is that typing from PowerShell: ssh -V return ==> OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

But when the myBash.sh bash script runs (/usr/bin/bash ...): ssh -V return --> OpenSSH_8.3p1 ...

Any thoughts ?

Additional Notes: The answer seems to lie here. It does ssh onto target but always leave this error mentioned. I tried to make a public key with no success.

question from:https://stackoverflow.com/questions/65854109/run-bash-script-in-powershell-with-ssh-fails-with-invalid-format

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
941 views
Welcome To Ask or Share your Answers For Others

1 Answer

Run

/usr/bin/ssh 192.168.1.56

instead (assuming this is the one you want to run).

Verify it using

/usr/bin/ssh -V

form bash, or

sh -c '/usr/bin/ssh -V'

from powershell.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...