SSH自动登录脚本】的更多相关文章

使用VPN,每次都要在Terminal上重复输入命令: ssh -D port user@host 出来密码提示符后,把复杂的密码拷贝下来,然后粘贴到Terminal,敲回车... 终于忍受不了这样的重复了,于是用Shell写一个可以自动登录的脚本: #!/usr/bin/expect -f set port port_no set user user_name set host host_name set password my_password spawn ssh -D $port $use…
ssh 一般要输入密码,自动设置的方法有两个: 1.通过expect来建立 #!/usr/bin/expect -f # expect在哪个目录下用whereis找下,不同的系统expect安装路径不一样的,如果#没有安装在安装光盘里有的 set timeout -1 spawn ssh -l user_name host_name/ip expect "password: " send "your_password\n" interact  #用exact这个指令…
原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11926792.html vi app-stg.sh #!/usr/bin/expect -f #auto ssh login set timeout spawn ssh hatianqi@181.171.161.10 expect "password:" send "12345678\r" interact wq后 app-stg.sh cd到脚本所在的目录,登录 ./…
expect可以让一些交互的任务自动完成,我们可以将一些交互过程写入脚本,ssh登录就是一个简单的实现,下面将介绍expect的用法. 1 安装 yum install -y expect 2 语法介绍 expect - send 这两个指令会配合使用,当expect接收到一个和预期字符串相匹配的输入,会执行send指令,send会发出字符串或者对应的指令. 执行如下脚本 expect "yes\n" send "What you type in is $expect_out…
h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child { margin-top: 0; padding-top: 0; } a:first-child h1, a:first-child h2, a:first-child h3, a:fi…
shell脚本实现ssh自动登录远程服务器示例: #!/usr/bin/expect spawn ssh root@192.168.22.194 expect "*password:" send "123\r" expect "*#" interact 原文链接:http://www.xuanhao360.com/linux-expects/ Expect是一个用来处理交互的命令.借助Expect,我们可以将交互过程写在一个脚本上,使之自动化完成…
自己写了个平时测试的app的自动登录脚本,亲测可运行.读者参照时只需要改包名.activity名称.坐标值.账号和密码即可 查看坐标是多少的方法:使用手机的指针位置来实现:系统设置---开发者选项---勾选指针位置,然后开启后,点击界面需要点击的控件就会显示X.Y轴坐标值了 查看包名和activity名称的方法:下载apktool,把里面的三个文件放到windows目录下,然后在cmd下输入:aapt dump badging 包的地址      如:aapt dump badging C:\U…
ssh自动登录的几种实现方法,记录在此.  1. 自动ssh/scp方法 A为本地主机(即用于控制其他主机的机器) ; B为远程主机(即被控制的机器Server), 假如ip为192.168.60.110; A和B的系统都是Linux 在A上运行命令: # ssh-keygen -t rsa (连续三次回车,即在本地生成了公钥和私钥,不设置密码) # ssh root@192.168.60.110 "mkdir .ssh" (需要输入密码) # scp ~/.ssh/id_rsa.pu…
expect实现ssh自动登录   #!/usr/local/bin/expect set PASSWD [lindex $argv 1] set IP [lindex $argv 0] set CMD [lindex $argv 2] spawn ssh $IP $CMD expect "(yes/no)?" { send "yes\r" expect "password:" send "$PASSWD\r" } "…
一.SSH免密码登录 假设要登录的机器为192.168.1.100,当前登录的机器为192.168.1.101. 首先在101的机器上生成密钥(如果已经生成可以跳过): $ ssh-keygen -t rsa一路回车即可. 然后在将生成的公钥复制到机器100上的~/.ssh/authorized_keys中,使用如下命令: $ ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.1.100root为需要登录到机器100上的身份,需要替换成需要的用户名. 最…