用在连接云服务器时不用输密码:
自己本地的输入有:
vim cloud_server
添加内容:#!/usr/bin/expect
spawn ssh 云服务器地址及端口号
expect “password:”
send “连接的密码\r”
interact
chmod 777 cloud_server
./cloud_server
报错:bash: ./cloud_server: /usr/bin/expect: bad interpreter: No such file or directory
解决:安装tcl,expect,主要参考下面两个博客,主要按照博客1,参考博客2
博客1:
Expect工具的安装及使用方法:https://blog.youkuaiyun.com/wangtaoking1/article/details/78268574
博客2:
linux下的expect的安装和使用:https://blog.youkuaiyun.com/silenceray/article/details/54582345
遇到问题:执行 ./configure --with-tcl=/usr/local/lib --with-tclinclude=…/tcl8.4.19/generic 后,显示错误checking for Tcl public headers… configure: error: …/tcl8.4.19/generic directory does not contain tcl.h
解决:结合博客2.把tcl.8.4.19放在/tmp/下,把执行语句改成tcl.8.4.19的具体位置,
变为: ./configure --with-tcl=/usr/local/lib --with-tclinclude=/tmp/tcl8.4.19/generic 解决问题。