expect ssh首次登录自动判断(yes/no)?
2015-05-27 10:26
225 查看
v-lhb-prx01:/root/sbin# sh ./expect.sh spawn ssh root@192.168.32.16 The authenticity of host '192.168.32.16 (192.168.32.16)' can't be established. RSA key fingerprint is da:3a:61:09:e4:f6:46:d7:01:08:1a:6c:b9:41:e8:4c. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.32.16' (RSA) to the list of known hosts. root@192.168.32.16's password: Last login: Wed May 27 09:37:32 2015 from 192.168.33.107 v-dev-redis02:/root# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg00-lv_root 7.7G 5.6G 1.8G 77% / tmpfs 499M 0 499M 0% /dev/shm /dev/sda1 194M 29M 155M 16% /boot v-dev-redis02:/root# exit logout Connection to 192.168.32.16 closed. ----------------------------------------------------------------------------------- expect { "(yes/no)?" { send "yes\n" expect "password:" send "$passwd\n" } "password:" { send "$passwd\n" } } # 下面测试是否登录到 expect "#" send "df -h\n" send "exit\r" expect eof
相关文章推荐
- ssh首次远程登录不用输入yes|no
- 《剑指Offer》输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。
- 判断一个字符串是否是回文,如果是,返回字符串“yes”,如果不是,返回字符串“no”
- 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。
- 给你一个数N(N<=10^100),让你判断是否能被11整除。。能整除输出YES,否则输出NO。
- 判断CAknQueryDialog是按YES还是NO
- 在启动页中判断是否自动登录
- 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。
- 判断n个数中的素数,是yes,不是no。
- 编写一个程序:输入一个身份证号,判断该号码对应的人是否是18至25岁女孩,是则输出”yes”,否则输出”no”
- window 自动登录sql 语句no like
- 解决整合 UCenter 首次注册同步登录与自动激活
- 【剑指offer24】输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。
- expect ssh自动登录脚本和kibitz
- SharedPreferences自动登录判断
- P53.37(设计一个程序,从键盘输入一个正整数M,判断该正整数是否左右对称,若对称,则输出yes,否则输出no。)
- expect ssh首次登录多台主机
- 【appium】判断是否登录,如果没有登录则自动登录
- ssh 登录出现Are you sure you want to continue connecting (yes/no)?解决方法
- js中判断有没有登录并自动跳转页面