expect脚本实现ssh自动登录
1:简单的实现ssh登录
#!/usr/bin/expect
set ip "10.0.0.142"
set user "root"
set password ""
spawn ssh $user@$ip
expect {
"yes/no"{ send "yes\n";exp_continue }
"password:"{ send "$password\r"}
}
interact
#!/usr/bin/expect
#Achieve ssh auto login
#This is the Achieve ssh auto login shell
#USEAGE: expect $0 secrect,eg expect $0 123456
set ip "10.0.0.142"
set user "root"
set password [lindex $argv 0]
spawn ssh $user@$ip
expect {
"yes/no"{ send "yes\n";exp_continue }
"password:"{ send "$password\r"}
}
interact
expect脚本实现ssh自动登录的更多相关文章
- linux expect详解(ssh自动登录)
shell脚本实现ssh自动登录远程服务器示例: #!/usr/bin/expect spawn ssh root@192.168.22.194 expect "*password:&quo ...
- iTerm2 实现 ssh 自动登录,并使用 Zmodem 实现快速传输文件
原文链接:https://fuckcloudnative.io/posts/iterm2-auto-login/ 对于 YAML 工程师来说,我们经常需要 ssh 登录不同的服务器,每次登录时都要经历 ...
- expect实现ssh自动登录
expect实现ssh自动登录 #!/usr/local/bin/expect set PASSWD [lindex $argv 1] set IP [lindex $argv 0] set CM ...
- Centos 解决SSH 免密码登录 以及Crontab制作定时SSH自动登录和关闭的脚本
一.SSH免密码登录 假设要登录的机器为192.168.1.100,当前登录的机器为192.168.1.101. 首先在101的机器上生成密钥(如果已经生成可以跳过): $ ssh-keygen -t ...
- ssh自动登录的4种实现方法
ssh自动登录的几种实现方法,记录在此. 1. 自动ssh/scp方法 A为本地主机(即用于控制其他主机的机器) ; B为远程主机(即被控制的机器Server), 假如ip为192.168.60.1 ...
- SSH自动登录config文件配置
title: SSH自动登录config文件配置 comments: false date: 2019-08-19 19:29:13 description: 更方便的 ssh 操作??? categ ...
- 用了一天的时间,linux下expect实现ssh自动登录服务器记,鄙视下网上各种抄来抄去残段子
因为要对客户方的快30个项目进行特别有顺序的重启,所以不得不想办法写个脚本,网上看了不少段子.真是残缺的可以.没有一段是可以正常运行的.我来按顺序记录一下 脚本的本身 使用expect实现自动登录的脚 ...
- 用expect实现SCP/SSH自动输入密码登录
在命令行ssh远程登录服务器和scp远程传输文件都需要交互式输入密码,无法像mysql登录数据库 mysql -uroot -p123456一样直接完成. 其实可以用脚本依赖expect来达到这一目的 ...
- linux通过expect工具来实现自动登录服务器,并执行相关操作
参考地址:https://www.cnblogs.com/liyuanhong/articles/7728034.html EOF的使用参考:https://www.cnblogs.com/liyua ...
随机推荐
- A - 不要62 HDU - 2089
#include<stdio.h> #include<string.h> #include<math.h> #include<time.h> #incl ...
- jmeter+influxdb+grafana性能测试监控
背景: 话说Jmeter原生的监控确实太丑了,听大佬们在讨论Jmeter+InfluxDb+Grafana的监控,于是,为了有一个漂亮的测试报告,就手动开始进行部署. 安装步骤: 1.influxdb ...
- tar命令-压缩,解压缩文件
tar: -c: 建立压缩档案 -x:解压 -t:查看内容 -r:向压缩归档文件末尾追加文件 -u:更新原压缩包中的文件 上面五个参数是独立的,压缩解压都要用到其中一个,可以和下面的命令连用但只能用其 ...
- 雷林鹏分享:jQuery EasyUI 数据网格 - 扩展编辑器
jQuery EasyUI 数据网格 - 扩展编辑器 一些常见的编辑器(editor)添加到数据网格(datagrid),以便用户编辑数据. 所有的编辑器(editor)都定义在 $.fn.datag ...
- requestAnimationFrame 兼容不同浏览器
简单兼容: window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitReq ...
- AngularJS +Kendo UI Grid template
var dataSource = new kendo.data.DataSource({ transport: { dataType: "json", read: inputUri ...
- C# 自定义配置文件
配置文件有两种设置方式,第一种是直接在网站根目录下的web.config中设置:第二种方式是自定义配置文件,在web.config中指定其他配置文件的路径. 第一种:除了在常用的appSettings ...
- 微服务-开发框架之springboot by 大雄daysn
目录 一.关于springboot 二.springboot的实践 2.1发布一个rest的api 2.2端点 2.3健康检查 2.4远程监控 一.关于springboot 由来:spring1.0- ...
- 两小时内sql
select convert(datetime,convert(char(20),dateadd(hour,-2,getdate())))
- Linux常用内核参数
Linux常用内核参数 TCP状态描述 CLOSED:无连接是活动的或正在进行的 LISTEN:服务器在等待进入呼叫 SYN-RECV:一个连接请求已经到达,等待确认 SYN-SENT:应用已经开始, ...