在PuTTY命令行上指定私钥 [英] Specifying private key on PuTTY command-line
问题描述
我知道有一些简单的命令可以通过VBA登录到远程计算机,即指定 User @ hostname
和 -pw
选项在 Wshell.Run
函数中提供密码,其中 Wshell
是 CreateObject( WScript .Shell)
。
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")
.
但是我需要使用私钥文件(在 Connection / SSH / Auth 下指定通过Excel-VBA宏登录时,在PuTTY中选择该选项)。有方法吗?
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?
我需要它,因为我在VBA代码的第二种形式上使用管理员帐户(第一种形式使用用户自己的帐户),并且因此无法在第二个表单上提供密码文本框。因此,唯一安全的解决方案是通过公钥和私钥使用SSH登录。
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.
预先感谢!
推荐答案
使用 -i
开关以指定私钥。
Use the -i
switch to specify the private key.
putty.exe username@example.com -i mykey.ppk
请参见 PuTTY命令行文档。
这篇关于在PuTTY命令行上指定私钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!