centos7 sshpass 用法详解

可以参考文章:https://www.cnblogs.com/kaishirenshi/p/7921308.html

安装方式直接通过yum 安装

yum -y install sshpass

常用的方式有以下几种

sshpass -p # 接密码

sshpass -f # 接文件,文件中有密码

示例如下

1)登陆服务器192.168.1.100

扫描二维码关注公众号,回复: 8218432 查看本文章

sshpass -f 1.txt  ssh [email protected]

sshpass -p 123456 ssh -p 1000 [email protected]

2)scp复制文件

sshpass -p '123456' scp [email protected]:/home/text.txt /root/

sshpass -p '123456' scp -P 2222 [email protected]:/home/text.txt /root/

 

 

猜你喜欢

转载自www.cnblogs.com/faberbeta/p/linux-shell029.html
今日推荐