如何自动输入密码? [英] How to automate password entry?

查看:182
本文介绍了如何自动输入密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

欲计算机(詹金斯节点)的列表上安装的软件库(SWIG)​​。我使用下面的脚本来自动完成这个有点:

I want to install a software library (SWIG) on a list of computers (Jenkins nodes). I'm using the following script to automate this somewhat:

NODES="10.8.255.70 10.8.255.85 10.8.255.88 10.8.255.86 10.8.255.65 10.8.255.64 10.8.255.97 10.8.255.69"
for node in $NODES; do 
  scp InstallSWIG.sh root@$node:/root/InstallSWIG.sh
  ssh root@$node sh InstallSWIG.sh
done

这种方式是自动的,除了为SCP和SSH命令所发生的密码请求。

This way it's automated, except for the password request that occur for both the scp and ssh commands.

有没有一种方法以编程方式输入密码?

Is there a way to enter the passwords programmatically?

安全不是一个问题。我在寻找不涉及SSH密钥的解决方案。

Security is not an issue. I’m looking for solutions that don’t involve SSH keys.

推荐答案

通过SSH做正确的方法是使用键而不是

With SSH the right way to do it is to use keys instead.

# ssh-keygen

,然后复制*的〜/ .ssh / id_rsa.pub *文件到远程机器(根@ ​​$节点)到远程用户的.ssh / authorized_keys文件。

and then copy the *~/.ssh/id_rsa.pub* file to the remote machine (root@$node) into the remote user's .ssh/authorized_keys file.

这篇关于如何自动输入密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆