作者:【吴业亮】云计算开发工程师
博客:http://blog.youkuaiyun.com/wylfengyujiancheng
安装sshpass
# yum --enablerepo=epel -y install sshpass
通过-p传入密码
# sshpass -p Changeme_123 ssh 192.168.10.238 hostname
wyl
将密码写入文件中,通过-f调用
# echo 'password' > sshpass.txt
# chmod 600 sshpass.txt
# sshpass -f sshpass.txt ssh 192.168.10.238 hostname
wyl
通过-e导入环境变量中的密码
# export SSHPASS=password
# sshpass -e ssh 192.168.10.238 hostname
wyl