Scheduling a script, password-protected PPK

Advertisement

jjeffers
Joined:
Posts:
4

Scheduling a script, password-protected PPK

I have read the docs and the FAQ, but I couldn't find an answer to this. My apologies if I missed it.

I'm connecting to a server that uses a password-protected private key file. I have created a batch file that runs a winscp script, and I use Pageant to store the key so I don't get prompted for the password. This all works fine if I run the batch file from the shell. However, it seems to hang when I run it as a scheduled task, even though I'm using the same user context when I run the scheduled task.

I can't see what's going on with the scheduled task, but my guess is that it's unable to get the private key info from Pageant, and is waiting for a password.

Is there any way to make this work? I really need this to be completely automated and run once per hour to grab files from the remote server. Here is my batch file and script file:

get_files.bat
@echo off
c:
cd \SCP
c:\progra~1\winscp3\winscp3 /console /script=C:\SCP\get_files.scp

get_files.scp
option batch on
option confirm off
open scp-connection
cd dropbox
option transfer binary
get *.csv C:\Data\
rm *.csv
close
exit

Thanks for any assistance you can offer.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

jjeffers wrote:

Unfortunately I don't have that option. The owners of the server I'm connecting to require a password protected key.
Just do not tell them :-)
Really, it does not make sense to protect the key used for automation, as you need to provide the password automatically somehow anyway. So what's the point?

Reply with quote

jjeffers
Joined:
Posts:
4

martin wrote:

jjeffers wrote:

Unfortunately I don't have that option. The owners of the server I'm connecting to require a password protected key.
Just do not tell them :-)
:lol:
So, I'm out of luck then?

Reply with quote

Advertisement

jjeffers
Joined:
Posts:
4

martin wrote:

Why? Do you know how to remove the password protection?
I know how to do it, but you know how it is with these kinds of things. If they discover that I've deviated from their requested security, there could be problems.

I did remove the password and test it, and it works fine, so I'll run it by them and see if it'll fly. Thank you for the help!

Reply with quote

sebastjan
Guest

removing password from ppk private key

Hello!
I have a similar problem with scripting and passphrase protected private key, but I don't know how to remove the password!? Can you please tell me, how to do that?

Thank you
Sebastjan


jjeffers wrote:

martin wrote:

Why? Do you know how to remove the password protection?
I know how to do it, but you know how it is with these kinds of things. If they discover that I've deviated from their requested security, there could be problems.

I did remove the password and test it, and it works fine, so I'll run it by them and see if it'll fly. Thank you for the help!

Reply with quote

martin
Site Admin
martin avatar

Re: removing password from ppk private key

sebastjan wrote:

I have a similar problem with scripting and passphrase protected private key, but I don't know how to remove the password!? Can you please tell me, how to do that?
Load it into the puttygen, remove the passphrase, and save it.

Reply with quote

Advertisement

ShawnHenry
Guest

remove password protection from ppk file

hey,all
actually i got the exactly same problem just now. but luckily i found out why. the error was called "couldn't load private key(unable to open file) ", mainly this is because of no permission to open file in that folder. thus i moved this file out and its working. hence please make sure whether you have absolutely right or not in that folder and then if doesn't work either please try to move this file out in somewhere

Reply with quote

Advertisement

You can post new topics in this forum