Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying private key on PuTTY command-line

I know there are simple commands to login to remote machine through VBA i.e. by specifying User@hostname and -pw option to provide the password in Wshell.Run function where Wshell is CreateObject("WScript.Shell").

However I need to use private key file (specified under Connection/SSH/Auth option in PuTTY) while logging in through Excel-VBA macro. Is there a way to do it?

I need it because I am using admin account on the second form of my VBA code (First form is using user's own account) and hence cannot provide the password textbox on the second form. Hence the only secure solution is to use SSH login through public and private key.

Thanks in advance!

like image 630
Sumit Avatar asked Jun 03 '16 11:06

Sumit


People also ask

Where does PuTTY store private keys?

PuTTY uses its own file format for SSH keys. The keys are stored in . ppk files.


1 Answers

Use the -i switch to specify the private key.

putty.exe [email protected] -i mykey.ppk

See PuTTY command line documentation.

like image 81
Martin Prikryl Avatar answered Oct 24 '22 00:10

Martin Prikryl