How to sftp without storing any session

Advertisement

vichu
Guest

How to sftp without storing any session

I try to connect to sftp thru command line interface. when connecting first time it ask me Do you want to add the host key to cache? (Yes,No,Cancel,Copy Key).
How to force the script to always select "No" option.

My script is

winscp.com /console /command "option batch on" "option confirm off" "open user:pwd@myServer -privatekey=""C:\temp\myprivateKey.ppk""" "cd Upload" "put My SFTPTest.txt" "exit" /log="C:\temp\Winscp.log"


Thanks in advance

Reply with quote

Advertisement

vichu
Guest

Re: How to sftp without storing any session

Thanks for your reply.

I am able to connect with -hostkey option. I like to know how to get the -hostkey information from privatekey using winscp command or script.

Reply with quote

martin
Site Admin
martin avatar

Re: How to sftp without storing any session

Hostkey is not stored in the private key. Host key is public key of the server. Private key is not specific to the server.

Reply with quote

vichu
Guest

Re: How to sftp without storing any session

martin wrote:

Hostkey is not stored in the private key. Host key is public key of the server. Private key is not specific to the server.


Thanks. I can able to get HostKey detail from PUTTYGen by importing the privatekey. I like to know how to get the hostkey information using Script.

Reply with quote

Advertisement

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

Re: How to sftp without storing any session

vichu wrote:

Thanks. I can able to get HostKey detail from PUTTYGen by importing the privatekey. I like to know how to get the hostkey information using Script.
You are not suppoed to get hostkey by the script. You should know the hostkey before and use it in the script.
Please read:
https://winscp.net/eng/docs/ssh

Reply with quote

Advertisement

You can post new topics in this forum