Topic "winscp3.com /console /script=f sftp://user1@server:1233"

Author Message
gmg

Guest


I have a batch script I want to run but can't seem to get it working.

When I pass the login thru the command-line, winscp3 logins but the script file isn't execute. If I don't pass in the login information the script file is execute. (the chicken or the egg)

winscp3.com /console /script=f sftp://user1@server:1233
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
You cannot combine "sftp://..."-like parameter with /script for security reasons. See documentation. Open the session from script instead.
_________________
Martin Prikryl
gmg

Guest


prikryl wrote:
You cannot combine "sftp://..."-like parameter with /script for security reasons. See documentation. Open the session from script instead.


I have tried 'open sftp://<uid>:<pwd>@<server>' in the script and it failed to login. It not accepting the password. I have event tried typing the password in and it still does work. Do I need to do anything else for sftp?.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Are you able to login from GUI?
_________________
Martin Prikryl
gmg

Guest


prikryl wrote:
Are you able to login from GUI?


No, it fails as well, the message I receive is below:

Authentication log (see session log for details):
Using username "<userid>".
GlobalSCAPE Secure FTP Server (v. 3.1)Authenticating with pre-entered password.
Access denied.
No supported authentication methods left to try!

Connection has been unexpectedly closed. Server sent command exit status 0.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Are you able to login wih any other SFTP or SSH client?
_________________
Martin Prikryl
Guest




prikryl wrote:
Are you able to login wih any other SFTP or SSH client?


I'm able to login using your program, via command line.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Quote:
I'm able to login using your program, via command line.

Sorry, it does not make sense. Above you wrote that you are not.
_________________
Martin Prikryl
gmg

Guest


prikryl wrote:
Quote:
I'm able to login using your program, via command line.

Sorry, it does not make sense. Above you wrote that you are not.


1. sftp only works when I run it thru the command line:
winscp3.com sftp://<uid>:<pwd>@<server>

2. When I try to login thru a script file that has the open command it fails

scripts file....
option batch on
option confirm on
option transfer binary
open sftp://<uid>:<pwd>@<server>
get *
close
exit
3. If I try to login thru the ui and doesn't fails as well.

I'm only able to get the command-line to work.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Please post a log file showing successful connection with command-line parameter and failed one with "open" command.
_________________
Martin Prikryl
KDearing

Guest


prikryl wrote:
You cannot combine "sftp://..."-like parameter with /script for security reasons. See documentation. Open the session from script instead.


I read the documentation and saw that but am left wondering how to handle this.. I need to do a simple get via automation (ie, sftp download)

My only thought at the moment is a big no-no (VB 'SendKeys'). I'm hoping that I'm just missing something..

Thanks in advance,

Kevin
KDearing

Guest


gmg wrote:
prikryl wrote:
Quote:
I'm able to login using your program, via command line.

Sorry, it does not make sense. Above you wrote that you are not.


1. sftp only works when I run it thru the command line:
winscp3.com sftp://<uid>:<pwd>@<server>

2. When I try to login thru a script file that has the open command it fails

scripts file....
option batch on
option confirm on
option transfer binary
open sftp://<uid>:<pwd>@<server>
get *
close
exit
3. If I try to login thru the ui and doesn't fails as well.

I'm only able to get the command-line to work.


Hey,
I'm hoping that you got this working - I did see in the documentation that it looks like it's not allowed for security reasons (which makes sense and all, but ...)

So, please let us know if and how you were able to get this to work. Thanks in advance,

Kevin
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
KDearing wrote:
So, please let us know if and how you were able to get this to work. Thanks in advance,

I simply should work. So if you can tell what exactly is your problem...
_________________
Martin Prikryl
KDearing
[View user's profile]

Joined: 2007-11-05
Posts: 2
Location: PA, USA
prikryl wrote:
KDearing wrote:
So, please let us know if and how you were able to get this to work. Thanks in advance,

I simply should work. So if you can tell what exactly is your problem...


Hi,
My problem is that I am trying to automate a simple download from a sftp server. I've been able to get it to open a console connection but the GET command (and any other commands I've tried) are simply not run. The console just sits there awaiting me to manually type the commands. This is in-line with what I read in the documentation.

I am not at my office so I don't have the actual scripts that I tried but I've been trying something like:

winscp.exe sftp://sftpuser@someserver.somehost.com:22 /privatekey=c:\kdearing\algo\test\pkey.pph /console /script=c:\kdearing\algo\test\download_test_001.txt


download_test_001.txt:

option batch on

option confirm off

cd /ftp/OUT

get somefilename.csv c:\kdearing\algo\test\

close

exit


I've also tried to put the open in the script like:

open sftp://sftpuser@someserver.somehost.com:22


but at that point I can't even get it to connect - well, the console window closes too quickly for me to see what's going on.

Furthermore I have not been able to get the /log
=c:\kdearing\algo\test\logfile.txt

to work (which also seems to be in-line with the documentation..)

--KDearing
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
KDearing wrote:
but at that point I can't even get it to connect - well, the console window closes too quickly for me to see what's going on.

Run winscp.com instead from opened console (cmd.exe) to keep the results on screen.
_________________
Martin Prikryl
jvc714

Guest


I'm having exactly the same problem.

I even tried to login using the consule and do a /command "PUT filename" it doesn't work.

I've tried the different combinations of the script file with no progress.

I've evern tried what I am not suppose to due to security like you said above and it still doesn't work.

I'm out of ideas and combinations to try. Is there a command for specifying the private key file in the script? I tried different combinations but unable to get it work either.

Thanks.
JT
KDearing
[View user's profile]

Joined: 2007-11-05
Posts: 2
Location: PA, USA
jvc714 wrote:
I'm having exactly the same problem.


Thanks to Prikryl's single comment of 'Use winscp3.com' I have gotten it working..

Here's the steps that I took (leaving out the stuff that didn't work of course! Very Happy )

  • Ran WinSCP's Gui.
  • Set up a saved session..
  • Logged on and accepted the certificate
  • Closed the session.
  • Created a batch file with this line:
    Code:
    "C:\program files\WinSCP\WinSCP.com"  algo /privatekey=C:\pathto\USE_THIS_PRIVATE_KEY.ppk /console /script=c:\pathto\today_script.txt /log=c:\pathto\daily_log.txt

  • Created the 'today_script.txt' as below
  • Done.. works perfectly!


Here's my today_script.txt file:

Code:
option batch on
option confirm off

open sftp://sftpuser@servername.com:22  /privatekey=C:\pathto\USE_THIS_PRIVATE_KEY.ppk

cd /ftp/OUT/

get somefile.csv C:\pathto\downloaded\

close

exit


THere may be extra stuff in there (like I probably only need to specify the private key once - if at all - I mean it's saved with the "algo" session..

Either way, awesome stuff!

--KTFA
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