使用plink在缓存中自动存储服务器主机密钥
使用plink在缓存中自动存储服务器主机密钥
来源 https://serverfault.com/questions/420526/auto-storing-server-host-key-in-cache-with-plink
我一直在尝试使用plink发出命令以从外部服务器检索信息。请注意,这些plink命令从不希望用户输入的二进制文件中运行。是否有一个标志可以让我覆盖此错误消息并继续执行程序输出?
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)
尝试在脚本前添加:
echo y | plink -ssh root@REMOTE_IP_HERE "exit"
这将管道y
通过角色stdin
来plink
当你在高速缓存中存储的关键?(y / n)提示,允许所有其他plink
命令通过而无需用户输入。exit
建立SSH会话后,该命令将关闭SSH会话,从而允许plink
运行以下命令。
这是一个示例脚本,该脚本将外部服务器的Unix时间写入本地文件:
echo y | plink -ssh root@REMOTE_IP_HERE "exit"
plink -ssh root@REMOTE_IP_HERE "date -t" > remote_time.tmp
管道参考:http : //tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-4.html
========= End
分类:
eve-ng
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
2019-01-02 C/C++ 各种进制的表示方法/ 进制前缀
2019-01-02 Java 入门进阶