在配置了 SSH 免密认证 id_rsa.pub 之后, 在 cmd 终端可以实现免密登陆对应配置了密钥的服务器, 但是在 python 程序中, 想要调用 cmd 执行免密操作, 还需要安装 sshpass,sshpass 用于非交互式的 SSH 密码验证
没有 sshpass 报错: to use the 'ssh' connection type with passwords, you must install the sshpass program
步骤:
1. 在官网下载源码包
wget http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz
2. 解压
tar xvzf sshpass-1.05.tar.gz
3. 进入解压文件
cd sshpass-1.05
4. 检验环境
./configure
5. 源码编译安装
make&&make install
来源: http://www.bubuko.com/infodetail-3344274.html