我可以将服务器的 RSA 主机密钥作为 PuTTY 命令行选项传递吗? [英] Can I pass RSA hostkey of server as PuTTY command line option?

查看:54
本文介绍了我可以将服务器的 RSA 主机密钥作为 PuTTY 命令行选项传递吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们是否可以在 PuTTY 命令行上选择发送 RSA 主机密钥作为类似于 WinSCP -hostkey 的参数.?

Do we have option on PuTTY command line to send RSA hostkey as an argument similar to WinSCP -hostkey.?

当前使用的PuTTY命令:

PuTTY command currently used:

putty.exe -ssh -l username -pw password -m command.txt RemoteServerIP

是否有像 WinSCP 这样的选项,可以像下面一样传递 RSA 主机密钥:

Is there a option like WinSCP where RSA hostkey can be passed just like below:

open sftp://username :password@RemoteServerIP/ -hostkey="ssh-rsa 2048 11:2c:5d:f5:22:22:ab:12:3a:be:37:1c:cd:f6:13:d1"

<小时>

如果我选择使用 PuTTY 来完成这项任务是一个糟糕的选择,请告诉我.


Also let me know, if my option of using PuTTY for this task is a bad option.

对有兴趣了解整个背景的人的详细说明:

  • 我开发了一个 Django 应用程序来启动一些远程脚本并完成任务.这使用 putty ssh 在后台使用子进程模块,参数从Django前端.

  • I have developed a Django application to kick off some remote scripts and get the task done. This uses putty ssh to run commands at the background using subprocess module, parameters are passed from the Djangofront end.

我面临的问题是,有多个用户会使用这个应用程序来启动他们的脚本.唯一的要求是他们有将服务器的 IP 地址和 RSA 密钥存储在配置文件中Django 服务器.

Problem I am facing is, There are multiple users who will use this application to kick off their scripts. Only requirement is they have to store IP address and RSA key of the server on a config file on Django Server.

由于所有服务器都使用 RSA 密钥,因此首次登录时它要求确认RSA指纹存储提示.

Since all of the servers use RSA key, for the first login it asks to confirm the RSA fingerprint storage prompt.

通常当我们从本地机器手动启动时,我们给出是的,第一次.和随后的运行它不会要求确认.

Usually when we kick off this manually from our local machine we give Yes, for the first time. and subsequent runs it won't ask for the confirmation.

由于这些脚本将在 DjangoServer 上运行,其中用户将无法访问,有没有办法我仍然可以运行使用 putty 的远程脚本?

Since these scripts will be running from a DjangoServer where users won't have access, is there a way I can still be able to run the remote scripts using putty?

请注意,我知道使用 WinSCP 启动脚本,但是不幸的是,在我们的环境中,我无法启动脚本WinSCP,但我可以使用 WinSCP FTP 并且我使用主机密钥选项,所以它不提示确认

Please note I am aware of kicking off script using WinSCP but unfortunately in our environment I cannot kickoff Scripts from WinSCP, but I can FTP using WinSCP and I use hostkey option so it does not prompt for confirmation

推荐答案

PuTTY 也 -hostkey 开关,只是语法略有不同:

PuTTY also has -hostkey switch, just with a slightly different syntax:

-hostkey 11:2c:5d:f5:22:22:ab:12:3a:be:37:1c:cd:f6:13:d1

<小时>

事实上,PuTTY 并不是自动执行命令的正确工具.


And indeed, PuTTY is not the right tool to automate command execution.

改为使用 Plink(PuTTY 命令行连接工具):

plink.exe -ssh -l username -pw password -hostkey aa:bb:cc:... hostname command

这篇关于我可以将服务器的 RSA 主机密钥作为 PuTTY 命令行选项传递吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆