设置 SFTP 以使用公钥身份验证
如何设置服务器到服务器 SFTP 以使用公钥身份验证而不是用户帐户和密码?
How do you setup server to server SFTP to use public-key authentication instead of user account and password?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在客户端中,您需要生成其公钥并将其添加到服务器的授权密钥列表中。
以下是您可以使用的命令。
在客户端计算机上
在服务器上
In the client you need to generate its public key and add it to server's authorized key list.
The following are the commands you can use.
On client machine
On the server
记住
还有
Remember to
and also
这是针对 Windows 用户的解决方案
,我在 Windows 上遇到了类似的问题,所以我使用了 http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
如果您需要生成公钥,请使用:
http://the.earth.li/~sgtatham/putty/latest /x86/puttygen.exe
然后,当您想要自动批量从 FTP 服务器下载 Pageant 以便将私钥加载到会话中时
http://the.earth.li/~sgtatham/putty/latest /x86/pageant.exe
然后使用 PSFTP 连接并执行操作
http://the.earth.li/~sgtatham/putty/latest /x86/psftp.exe
所以这里是批处理的示例代码:
命令列表文件(sftp_cmd.txt)将像这样:
现在,您需要在计划任务中安排它
*我希望它像 unix 的 cron 工作一样简单......
This is a solution for windows users
I had a similar issue on windows so I used Putty from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
If you need to generate a public key then use:
http://the.earth.li/~sgtatham/putty/latest/x86/puttygen.exe
Then, when you want to automate a batch to download from the FTP server the Pageant in order to load the private key into session
http://the.earth.li/~sgtatham/putty/latest/x86/pageant.exe
Then use the PSFTP to connect and perform actions
http://the.earth.li/~sgtatham/putty/latest/x86/psftp.exe
So here is sample code for the batch:
Command list file (sftp_cmd.txt) will like like this:
Now, all you need to to schedule it in scheduled tasks
*I wish it was simple as unix's cron job....