Topic "Scripting and Authenticating"

Author Message
Joe

Guest


Hi,
I plan to create a script file on the fly from within my program and then run it using Winscp (the host machine could be any machine).
The scripts will be used to get a directoy listing, copy some files etc.
Here's one script for example:

option batch on
option confirm off
open scp://user:password@host
option transfer binary
get file c:\
close
exit



When I run it I get the follwoing:
Searching for host...
Connecting to host...
Authenticating...
The server's host key was not found it the cache. You have no guarantee that the
server is the computer you think it is. The server's key fingerprint is: ssh-rs
a 1024 46:81:df:51:fa:d1:df:5c:eb:37:5d:07:c8:16:04:1c
If you trust this host, press Yes. To connect without adding host key to the cac
he, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache?
(Y)es, (N)o, (C)ancel: Cancel
Authentication failed.
Host key wasn't verified!


The (C)ancel option is selected automatically.
Any ideas?

Thanks,
Joe
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You must first login to your server in non-batch mode (either using GUI or scripting) to confirm its key.
_________________
Martin Prikryl
Joe

Guest


Thanks for the reply.
The problem is that I don't know which server the user will choose to connect to.
The user enters the server name, and can enter any server.

Is there no way to confirm this key using a batch mode?
(I just want the confirmation question to be answered 'Yes' automatically, or disable this confirmation step).

Thanks again,
Joe
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
It would be against purpose of SSH as confirmation of the key is one of its basic principles. Without it, you can use FTP instead of SSH.

If there is a set of servers (not unlimited number of them), you can confirm them all in advance.

If this does not help, let me know, what you are tring to do. Maybe I'll find a solution for you.
_________________
Martin Prikryl
Joe

Guest


Yes, there is a set of servers.
I can indeed confirm the set in advance (which will be an annoying task by itself), but the thing is that every time a new server will be added I'll have to manually confirm it.

I guess I can live with that. It's not perfect, but it's not a big deal.

Thanks for the fast and clear answers!
Joe

btw, what I'm trying to do is to get a list of files from a remote machine and then transfer some of them to the invoking machine. The host, user and password of the remote are entered by a user, so the set of the possible servers can be big. Of course that after I'm getting the files I do other things with them (it's not that my whole application is to transfer files)
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Joe wrote:
btw, what I'm trying to do is to get a list of files from a remote machine and then transfer some of them to the invoking machine. The host, user and password of the remote are entered by a user, so the set of the possible servers can be big. Of course that after I'm getting the files I do other things with them (it's not that my whole application is to transfer files)

Can you avoid using "option batch on" and let the users confirm the key themselves? That would of course mean that the users understand what does it mean to confirm the key.
_________________
Martin Prikryl
Joe

Guest


hmmm.. can't really prompt the user with these questions. The invoking process is a servlet running on a web server.
Guest




I am having the exactly the same problem.

I am scheduling my script via a job scheduling system called Espresso. If I leave the option batch on in the script then cancel is automatically enetered and if I remove it, then the script hangs and I have no way of inputting yes.

Any help would be greatly appreciated.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Anonymous wrote:
I am having the exactly the same problem.

I am scheduling my script via a job scheduling system called Espresso. If I leave the option batch on in the script then cancel is automatically enetered and if I remove it, then the script hangs and I have no way of inputting yes.

Any help would be greatly appreciated.

Please do not double post.
Soma

Guest


Hi All,
I am also having the same problem, it asked me to press yes no cancel, even i pressed yes, but no use, even i ran the below command in CMD mode but when i do in CMD mode it is working fine, but if i shedule the notes agent , then i am getting the error, please advice me.

WinSCP3 sftp://a3skppro:conf2ssi@1.1.111.11:22

please advice me.
regds
oma
Guest




Hi Martyn,
You asked us to first login to our server in non-batch mode (either using GUI or scripting) to confirm its key.

shall we login remotely or we should run the batch mode only from the server PC , please advise me.
thanks
with regds
soma
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Anonymous wrote:
You asked us to first login to our server in non-batch mode (either using GUI or scripting) to confirm its key.

shall we login remotely or we should run the batch mode only from the server PC , please advise me.

You should login in the same environment where the script will be running.
_________________
Martin Prikryl
Mvalle

Guest


I have the same problem, I change in the tab Preferences--Transfer--Storage and change configuration Store to INI File, the I use GUI to loggin in server, then a windows appers with the messagge :

"The server's host key was not found it the cache. You have no guarantee that the
.....(Y)es, (N)o, (C)ancel: Cancel"
then in GUI windows Press Yes...after that, Close and try in Scheduled Task and Works fine...I hope this way works for you too...
(Pd: sorry my english isn`t good Crying or Very sad )
mabbrew
[View user's profile]

Joined: 2008-08-19
Posts: 1
Location: raleigh, nc
Is there a way or how can I schedule an ftp. I am not computer savy enough to begin scripts. Is there a front end way I can set this up?
JRB_BMB
[View user's profile]

Joined: 2008-07-01
Posts: 24
Location: Midlands, UK
Copy this into a notepad window and save it as Filename.BAT;

Code:
@ECHO OFF
BREAK=OFF

CD C:\
CD Program Files
CD winSCP
START winscp.com QDSFTP /console /script=FTPScript.txt

EXIT


Then all you have to do is create a basic winSCP script and then use the windows scheduler to have this bat file run when you want.
Hope that helps.

oh and as a note; if it has issues then change 'CD C:\' to 'c:' or whatever drive letter you need. Oh and you can change thr ftp script name to your as well ;o)
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
mabbrew wrote:
Is there a way or how can I schedule an ftp. I am not computer savy enough to begin scripts. Is there a front end way I can set this up?

There's no GUI for scheduling. I hope that with this FAQ you will be able to setup the script. If not, let me know what you are missing in the answer.
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