Topic "How to sftp without storing any session"

Author Message
vichu

Guest


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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Please read documentation:
http://winscp.net/eng/docs/message_host_key
_________________
Martin Prikryl
vichu

Guest


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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Hostkey is not stored in the private key. Host key is public key of the server. Private key is not specific to the server.
_________________
Martin Prikryl
vichu

Guest


prikryl 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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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:
http://winscp.net/eng/docs/ssh
_________________
Martin Prikryl
vichu

Guest


prikryl wrote:
You are not suppoed to get hostkey by the script. You should know the hostkey before and use it in the script.

Please read:
http://winscp.net/eng/docs/ssh[/quote]

Thanks Prikryl. I will save the session first and then use it thru my script.
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