Using saved SSH keys for WinSCP.com (SFTP Scripting)

Advertisement

josegrande
Joined:
Posts:
7

Using saved SSH keys for WinSCP.com (SFTP Scripting)

I am writing a batch file to allow use of SFTP for some of our employees.

Can the automation with WinSCP.com use the saved SSH keys from the WinSCP.exe GUI for authentication?

we have about 20 different servers throughout the country. I could write a bunch of if statements in the batch file and include each and every fingerprint, but
ideally, it would be nice to have it access that .ini file (or registry) for the keys.

Reply with quote

Advertisement

josegrande
Joined:
Posts:
7

RE;

Okay, I found that you must use the \ini= option for registry or \ini=\File.ini for .ini.

Now doing so, it will used Cached keys, but also now it will ask for unknown hosts. Can I get it to automatically disconnect if it finds an unknown host? I don't want users to blindly accept not knowing what it's asking.

Reply with quote

josegrande
Joined:
Posts:
7

Re:

No one answered, but I found the answer out of curiosity.

You must specify the ini ANNND use -hostkey="".

If the host key isn't in the init, it will try to use the specified host key, and since the specified host key if blank, it will fail telling you they "Don't Match".

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: Using saved SSH keys for WinSCP.com (SFTP Scripting)

josegrande wrote:

we have about 20 different servers throughout the country. I could write a bunch of if statements in the batch file and include each and every fingerprint
What do you need "if" statements for? Include host keys along with the other connection info in your batch file.

Now doing so, it will used Cached keys, but also now it will ask for unknown hosts.
The latest version of WinSCP aborts a script, if it sees an unknown hostkey. You must be using some old version of WinSCP.

Reply with quote

Advertisement

You can post new topics in this forum