Hey Martin. I am new to all this scripting and especially using the Private and Public Keys so that is correct. When I put in the private key and ran the script from the bat file it worked. I figured that the Private key worked as well. When I switched to using the Task Scheduler to run the script it failed. As you can see from the logs. I did not know that the private key failed until I put in the log tracking again. I have no idea why its working when you run the bat file since the password was removed from the bat file. When I got the private key setup I also sent the public key to the place we are connecting to.
If you look in the log it says
Server offered these authentication methods: publickey,password
. 2018-05-08 15:17:57.261 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2018-05-08 15:17:57.261 Using stored password.
. 2018-05-08 15:17:57.261 Sent password
. 2018-05-08 15:17:57.651 Access granted
. 2018-05-08 15:17:57.651 Opening session as main channel
. 2018-05-08 15:17:57.683 Opened main channel
. 2018-05-08 15:17:57.807 Started a shell/command
To me that says that the remote server sent the password? Why would it do that. I know the private key is not working, which I have no idea why either, but it still allow it to connect.
But then in the log from when this was run from the Task Scheduler it shows.
Server offered these authentication methods: publickey,password
. 2018-05-08 15:24:59.977 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2018-05-08 15:25:10.117 Sent password
. 2018-05-08 15:25:13.518 Password authentication failed
! 2018-05-08 15:25:13.518 Access denied
. 2018-05-08 15:25:13.518 Server offered these authentication methods: publickey,password
. 2018-05-08 15:25:13.518 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2018-05-08 15:25:23.658 Disconnected: Unable to authenticate
Why the difference? Why would it allow it when you run it direct from the bat file but not when its run from the Task Scheduler?
It seems there are two issues here.
1. Why is it allowing access from one method to another
2. Why is it not accepting the private key?
Thanks
Rob