Topic "Scheduling a script, password-protected PPK"

Author Message
jjeffers
[View user's profile]

Joined: 2006-07-07
Posts: 4
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
Code:
@echo off
c:
cd \SCP
c:\progra~1\winscp3\winscp3 /console /script=C:\SCP\get_files.scp


get_files.scp
Code:
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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Just remove the password protection from the key.
_________________
Martin Prikryl
jjeffers
[View user's profile]

Joined: 2006-07-07
Posts: 4
Unfortunately I don't have that option. The owners of the server I'm connecting to require a password protected key.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
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 Smile
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?
_________________
Martin Prikryl
jjeffers
[View user's profile]

Joined: 2006-07-07
Posts: 4
prikryl 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 Smile

Laughing
So, I'm out of luck then?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
jjeffers wrote:
So, I'm out of luck then?

Why? Do you know how to remove the password protection?
_________________
Martin Prikryl
jjeffers
[View user's profile]

Joined: 2006-07-07
Posts: 4
prikryl 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!
sebastjan

Guest


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:
prikryl 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!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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.
_________________
Martin Prikryl
ShawnHenry

Guest


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
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License