author:headsen chen
date : 2017-11-29 15:46:39
notice:created by headsen chen himself and not allowed to copy,or will done by low.
sshpass全国超级使用第一人
应用范围:可以在命令行直接使用密码来进行远程连接和远程拉取文件。
使用前提:对于未连接过的主机。而又不输入yes进行确认,需要进行sshd服务的优化:
#vim /etc/ssh/ssh_config
StrictHostKeyChecking no#vim /etc/ssh/sshd_config
GSSAPIAuthentication no
UseDNS no
# service sshd restart
sshpass 命令的安装:
# yum -y install sshpass
实例1:直接远程连接某台主机:
命令:sshpass -p xxx ssh root@192.168.11.11
sshpass -p xxx ssh root@192.168.11.11 'w' -o StrictHostChecking=no 免输入yes。
实例:本地执行远程机器的命令:
命令:sshpass -p xxx ssh root@192.168.11.11 "ethtool eth0"
实例2:远程连接