Topic "WinSCP.com actions being duplicated?"

Author Message
BVer
[View user's profile]

Joined: 2016-04-04
Posts: 1
I can't tell if the actions WinSCP is taking are actually being duplicated or if it's some kind of echo issue, but here is the command I'm running and the output I'm seeing. Sensitive info masked

Code:
C:\Repository\support\tools\WinSCP>"C:\Repository\support\tools\WinSCP\WinSCP.com" -hostkey=* <username>@<servername> /privatekey=C:\Repository\support\tools\WinSCP\putty_ssh.ppk /command "call pwd" "exit"
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Searching for host...
Connecting to host...
Authenticating...
WARNING! Giving up security and accepting any host key as configured!
Using username "<username>".
Authenticating with public key "imported-openssh-key".
Authenticated.
Starting the session...
Session started.
Active session: [1] <username>@<servername>
Searching for host...
Connecting to host...
Authenticating...
WARNING! Giving up security and accepting any host key as configured!
Using username "<username>".
Authenticating with public key "imported-openssh-key".
Authenticated.
Starting the session...
Session started.
/home/<username>

C:\Repository\support\tools\WinSCP>


Everything seems to function as expected but it almost appears if it's creating a session within a session or something and executing the steps a second time.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You are opening SFTP session. The SFTP protocol does not allow you to execute shell commands. So WinSCP opens secondary shell session to execute your command.
If the only purpose of your script is to execute the command (i.e. no file transfer), open a shell/SCP session directly by using scp:// protocol prefix.

Ideally, you should use open command. And make sure you understand that you give up any security by using -hostkey=*.

"C:\Repository\support\tools\WinSCP\WinSCP.com" /command "open -hostkey=""real hostkey"" scp://<username>@<servername> -privatekey=C:\Repository\support\tools\WinSCP\putty_ssh.ppk" "call pwd" "exit"
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