解决SSH第一次登录需要交互确认的问题

2023-05-16


up vote 12 down vote favorite
4

i've been trying to issue commands using plink to retrieve information from my external server. note that these plink commands are ran from a binary that expects no input from the user. is there a flag that will allow me to override this error message and continue with program output?

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)

thank you!

linux  ssh  bash  putty  host
share improve this question
edited Aug 23 '12 at 18:44
asked  Aug 23 '12 at 18:28
Tad Oh
63 1 1 5
 
 
The real issue is that either git doesn't properly give away input to plink or vice versa plink doesn't properly take it. If you launch git clone in, e.g. "git bash", the input (Y/n) goes then into bash prompt, and bash usually responds with bash: y: command not found. –  andrybak  Nov 18 '15 at 15:47
add a comment

2 Answers

active oldest votes
up vote 11 down vote accepted

Try prepending your script with:

echo y | plink -ssh root@REMOTE_IP_HERE "exit"

This will pipe the y character through stdin to plink when you get the Store key in cache? (y/n)prompt, allowing all further plink commands to pass through without the need of user input. The exit command will close the SSH session after it has been established, allowing the following plink commands to run.

Here's an example script which writes the external server's Unix time to a local file:

echo y | plink -ssh root@REMOTE_IP_HERE "exit"
plink -ssh root@REMOTE_IP_HERE "date -t" > remote_time.tmp

Pipelining Reference: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-4.html

share improve this answer
edited Aug 23 '12 at 20:42
answered  Aug 23 '12 at 18:29
Daniel Li
532 2 7 23
 
 
wow that worked, thanks –  Tad Oh  Aug 23 '12 at 18:54
add a comment
up vote 0 down vote

maybe, it will help:

plink -auto_store_sshkey -batch 192.211.158.256 -l user -pw password command
share improve this answer
edited Jan 14 '14 at 15:45
Michael Hampton
114k 16 186 381
answered  Jan 14 '14 at 15:43
Falcluft
11
 
 
-auto_store_sshkey is an "unknown option" for plink version 0.63 –  Nathan  Aug 20 '14 at 18:49
 
Unknown to 0.66 too –  Joril  Dec 18 '15 at 14:39

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

解决SSH第一次登录需要交互确认的问题 的相关文章

  • Melodic + Realsense D435i 配置及错误问题解决

    Melodic 43 Realsense D435i 配置及错误问题解决 安装环境 xff1a RealSense SDK安装1 克隆SDK2 安装相关依赖3 安装权限脚本4 进行编译与安装5 测试安装是否成功6 错误汇总0x01 进行编译
  • Realsense-Ros安装配置介绍与问题解决

    Realsense Ros安装配置介绍与问题解决 Realsense Ros安装配置功能包克隆与编译编译错误与问题分析解决方案 结束语 本文主要讲述在如何进行Realsense Ros的安装与配置 xff0c 以及提出在安装配置过程中遇到相
  • 树莓派3 Ubuntu Meta16.04 操作系统烧录教程及系统换源

    树莓派3 Ubuntu Meta16 04 操作系统烧录教程及系统换源 1 写在开头 xff1a 2 操作系统烧录软件下载3 Ubuntu Meta 操作系统下载4 操作系统烧录4 1 SD 存储卡格式化4 2 操作系统写入4 3 换源更新
  • Ubuntu nautilus 快速打开文件浏览器

    Ubuntu nautilus 快速打开文件浏览器 1 问题描述2 nautilus 命令说明3 bashrc 下使用 alias 创建命令别名Reference 测试时间 xff1a 2022年6月20日 测试平台 xff1a Ubunt
  • 结构体嵌套结构体,及其的初始化

    作用 xff1a 结构体的的参数成员包含另一个结构体 利用 操作符来逐级访问结构体中的元素 1 先来个普通的结构体嵌套 xff0c xff08 不涉及数组 xff09 span class token macro property span
  • Spark Streaming + Spark SQL 实现配置化ETL流程

    Spark Streaming 非常适合ETL 但是其开发模块化程度不高 xff0c 所以这里提供了一套方案 xff0c 该方案提供了新的API用于开发Spark Streaming程序 xff0c 同时也实现了模块化 xff0c 配置化
  • 程序员永远的痛之字符编码的奥秘

    字符编码相信是每个程序员的噩梦 xff0c 只要是有中文的地方 xff0c 总是会遇到各种编码的问题 xff0c 并且这种问题还非常难缠 xff0c 尤其在linux上 xff0c 因为上面很多软件都是针对英语国家开发的 xff0c 是不会
  • 2013年终总结

    年终感悟 xff1a 2013年就这样过去了 xff0c 每个人都一样 xff0c 使用了自己一年生命药水 xff0c 要知道这种药品是花多少钱都买不来的 现在回头看看 xff0c 我用这一瓶药水都做了那些事情 在这一年里 xff0c 有过
  • C++11 之for 新解

    前言 C 43 43 11这次的更新带来了令很多C 43 43 程序员期待已久的for range循环 xff0c 每次看到javascript xff0c lua里的for range xff0c 心想要是C 43 43 能有多好 xff
  • c++11之初始化列表

    一 前言 C 43 43 的学习中 xff0c 我想每个人都被变量定义和申明折磨过 xff0c 比如我在大学笔试过的几家公司 xff0c 都考察了const和变量 xff0c 类型的不同排列组合 xff0c 让你区别有啥不同 反正在学习C
  • Unity Update 详解

    0x01 简介 Unity的脚本继承了Monobehaviour类 xff0c 在脚本中定义函数 xff1a void FixedUpdate span class hljs list span void span class hljs k
  • 2016总结

    欲言又止 xff1a 每年的年终总结是要在新年之前发表在博客上 xff0c 今年的年终总结拖到现在完成 xff0c 我也是服自己 这里要感谢我的高中好友 64 万学清同学 xff0c 在我去年微信发表的有关年终总结的朋友圈下 xff0c 催
  • 阅读代码和修改别人代码的一些技巧以及注意事项

    作为刚刚走上工作岗位的fish xff0c 都要熟悉前辈们留下来的代码 这段时间是fish最痛苦的时间同时也是最轻松的时间 痛苦是因为要看大量的代码 xff0c 同时要慢慢从学生到社会人士的转变 xff08 xff0c 再不能睡懒觉了 xf
  • 一个分号引发的血案

    最近在看 Data Structures and Algorithms 这本书 xff0c 书里对数据结构和算法进行了简单的描述 xff0c 并且用伪码进行了实现 伪码毕竟和代码还是有很大不同的 xff0c 书的说明里说有C 写的源码 xf
  • Iphone客户端程序员半年工作总结

    来公司四个半月了 xff0c 从对客户端游戏编程的小白慢慢的也能写一些东西了 xff0c 当然了这里最感谢的人就是九天了 xff0c 对于九天其它的好我就不说了 xff0c 就是感觉九天为了团队 xff0c 为了项目 xff0c 他在很用心
  • Unity Android Activity控制

    前言 开发游戏 xff0c 在国内发行 xff0c 接入各个渠道SDK是一件绕不开的事情 并且这件事非常复杂琐碎 xff0c 原因如下 xff1a a 发行平台多 xff0c Android平台有30 xff0c 40家主流发行平台 b 每
  • MongoDB ODM 框架MongoMongo-简化你的数据存储

    MongMongo是一个用Java写的ODM框架 xff0c 使得对MongoDB的操作更加便捷 MongoMongo努力为Java开发者提供类似于ActiveORM 或者 Hibernate的操作API 并且保留了MongoDB的sche
  • Unity Android 加载动态库

    前言 在接入360 Android SDK时遇到在有些机型的Android机器上报错 xff0c 具体错误提示为 xff1a Failure to initialize Your hardware does not support this
  • 德鲁克谈《自我管理》笔记摘要

    一 我的长处是什么 多数人都以为他们知道自己擅长什么 xff0c 其实不然 要发现自己的长处 xff0c 唯一的途径就是分析回馈法 写下自己预期的结果 9 12个月后 xff0c 将实际结果和预期比较 总结改善自己的预期和行动 我们要以持之
  • ubuntu下搭建cocos2dx编程环境-上

    这大半年一直在开发flash游戏 xff0c 用到的编程语言是actionscript和c 43 43 所以这次公司决定开发手游端的话 xff0c C 43 43 不是很生疏 xff0c 这是个好消息 坏消息是由于现在网页游戏还没有上线 x

随机推荐