我正在使用 psftp.exe 自动下载文件,但需要使用私钥连接,如下所述。我能够连接,但是,私钥需要密码。
此过程有效,但我必须从键盘输入密码,这会破坏从命令行运行的过程。我想知道是否有人可以告诉我如何在命令行中发送密码。
Using Putty's PSFTP.exe With A Private Key
Command Line:
c:\putty\psftp.exe username@ftpsite.com -i putty_id_rsa_1024.ppk -b c:\putty\myscript.scr
Command Line Notes: Replace username with your login name and modify the "putty_id_rsa_1024.ppk" key name to match your key. In order to use a key, you will need to use puttygen.exe to generate, import, and or export your keys. PuTTY requires a putty key file to make a private key connection.
myscript.scr file contents:
cd /
put File1.txt
put File2.txt
put …Run Code Online (Sandbox Code Playgroud)