Setting a private key on the PuTTY command line

I know that there are simple commands for entering the remote computer through VBA, that is, by specifying the option User@hostnameand -pwfor providing the password in Wshell.Run, where it Wshellis CreateObject("WScript.Shell").

However, I need to use the private key file (specified in the Connection / SSH / Auth parameter in PuTTY) when entering the Excel-VBA macro. Is there any way to do this?

I need this because I use an administrator account in the second form of my VBA code (the first form uses its own user account) and therefore cannot provide a password text field in the second form. Therefore, the only safe solution is to use SSH login through public and private keys.

Thanks in advance!

+9
source share
1 answer

Use the switch-i to specify the private key.

putty.exe username@example.com -i mykey.ppk

See the PuTTY command line documentation .

+19
source

All Articles