use -hostkey="your key"
Use
-hostkey="your key"
-hostkey="your key"
private string fnGetSFTPFingerPrint()
{
if (!ObjSFTP.UnlockComponent("CSHANMSSH_5VswUWpF4Rnk"))
return "Unlock Component Failed.";
ObjSFTP.ConnectTimeoutMs = 5000;
ObjSFTP.IdleTimeoutMs = 10000;
int Port = Convert.ToInt32(txtPort.Text);
bool success;
Chilkat.SshKey key = new Chilkat.SshKey();
if (!ObjSFTP.Connect(txtHost.Text, Port))
return "Connection Failed.";
string privKey;
privKey = key.LoadText(txtPrivateKeyPath.Text); //("myPrivateKey.pem");
if (privKey == null)
return "Connection Failed.";
success = key.FromOpenSshPrivateKey(privKey);
if (success != true)
return "Connection Failed.";
if (!ObjSFTP.AuthenticatePk(txtUserName.Text, key))
return "Connection Failed.";
if (!ObjSFTP.InitializeSftp())
return "Initialization Failed.";
string handle;
handle = ObjSFTP.OpenDir(txtDestination.Text);
if (handle == null)
return "Open Dir Failed.";
txtFingerKeyPrint.Text = ObjSFTP.HostKeyFingerprint;
return ObjSFTP.HostKeyFingerprint;
}
-hostkey
. If you get different results, please start a new topic and attach a complete session log file.
open
command with -hostkey
, will it produce any error?
i call this command in my program:lanceAppli("winscp.com /script= scp.txt")
in myscp.txt
i put
...
/script= scp.txt
is the problem. This way, WinSCP does not connect /script=
with scp.txt
. It ignores empty /script
switch and tries to connect to host scp.txt
.
Okay so forget that I said the scripting part but asking for it to save the information in the registry, in my opinion, is a valid request that other people may like to see. If I've entered the key once for a site, why should I have to continue to enter it? I've already validated that I know the key and it matches the site I'm connecting to, which I believe maintains the security. I just want to store it for future connections to that site.
Recherche de l'hote.....
Host does not exist.
winscp>
lanceAppli("winscp.com /script= scp.txt")
scp.txt
I put:
option confirm off
open sftp://mylogin:myPW@MyIP:port -hostkey="ssh-rsa 1024 aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa"
option Transfer binary
put filename.ext
close
exit
Host does't exist.
winscp.com
winscp>option confirm off
confirm off
winscp>
-hostkey
. Or you want to cache the hostkey for regular (non-automatic) use. Than you can do it from GUI or by importing the settings to registry (you can do it automatically as well). You are mixing two different things together.
However, I noticed that even though I'm specifying the host key, it doesn't store the fingerprint in the registry. Is there another option to store that?
open sftp://user:pass@site.com -hostkey="ssh-rsa 1024 46:62:9d:86:45:d0:b9:b2:b4:0f:61:a2:af:40:8a:ea"
open sftp:user:pass@site.com /hostkey="ssh-rsa 1024 46:62:9d:86:45:d0:b9:b2:b4:0f:61:a2:af:40:8a:ea"
open
command. Basically you need to enclose the host key to quotes.
open sftp:user:pass@site.com /hostkey=ssh-rsa 1024 46:62:9d:86:45:d0:b9:b2:b4:0f:61:a2:af:40:8a:ea
-hostkey
option to the open
command. I can't seem to get it to function. It's as if I didn't put the option in the script file at all, the program simply stops without opening up a session. Does anyone have an example of a command line that works for this feature, with this version of WinSCP?