Scripting and Authenticating

Advertisement

Joe
Guest

Scripting and Authenticating

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
Location:
Prague, Czechia

Re: Scripting and Authenticating

You must first login to your server in non-batch mode (either using GUI or scripting) to confirm its key.

Reply with quote

Joe
Guest

Re:Re: Scripting and Authenticating

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
Location:
Prague, Czechia

Re:Re: Scripting and Authenticating

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.

Reply with quote

Joe
Guest

Re:Re: Scripting and Authenticating

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)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
Location:
Prague, Czechia

Re:Re: Scripting and Authenticating

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.

Reply with quote

Joe
Guest

Re:Re: Scripting and Authenticating

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

Reply with quote

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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
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.

Reply with quote

Advertisement

Soma
Guest

I run the batch manually from CMD mode but still i have the

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

Reply with quote

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
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.

Reply with quote

Mvalle
Guest

Scripting and Authenticating

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 :cry: )

Reply with quote

Advertisement

mabbrew
Joined:
Posts:
1
Location:
raleigh, nc

schedule FTP

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?

Reply with quote

JRB_BMB
Joined:
Posts:
24
Location:
Midlands, UK

Copy this into a notepad window and save it as Filename.BAT;

@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)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
Location:
Prague, Czechia

Re: schedule FTP

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.

Reply with quote

Advertisement

You can post new topics in this forum