WinSCP.com actions being duplicated?

Advertisement

BVer
Joined:
Posts:
1

WinSCP.com actions being duplicated?

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

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: WinSCP.com actions being duplicated?

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"

Reply with quote

Advertisement

You can post new topics in this forum