centos7如何安装sshpass
-
先安装epel
yum install -y epel-release
yum repolist
-
安装完成epel之后,就可以按照sshpass了
yum install -y sshpass
- 验证:sshpass -V
-
[root@hostuser ~]# sshpass -V sshpass 1.06 (C) 2006-2011 Lingnu Open Source Consulting Ltd. (C) 2015-2016 Shachar Shemesh This program is free software, and can be distributed under the terms of the GPL See the COPYING file for more information. Using "assword" as the default password prompt indicator. [root@hostuser ~]#
使用方法
sshpass -p "yourpassword" ssh yourusername@ip 等价于 ssh root@ip 再输入密码
当远程主机端口不再是22默认端口时候:
-
sshpass -p "password" ssh -p 8443 username@ip