sshpass 的使用

ssh远程连接时,每次都提示需要输入密码。需要ssh到多台机器时很不方便。sshpass可以解决这个问题。sshpass可以实现ssh的自动的登录。直接在命令里输入密码,但是安全性的问题需要自己判断。
安装
1.Installing on Ubuntu
apt-get install sshpass
2.Installing on OS X**
开始之前需要安装install xcode and command line tools.
之后安装Installing with Homebrew
由于安全问题,brew 官方默认不允许安装,可以尝试如下方法:
brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb

3.源码安装
Download theSource Code
Extract it and cd into the directory
./configure
sudo make install
用法

[root@zhu ~]# sshpass --help
sshpass: invalid option --'-'
Usage: sshpass [-f|-d|-p|-e] [-hV]commandparameters
-ffilename  Take password to use from file
-dnumber    Use number as file descriptorforgetting password
-p password  Provide password as argument (security unwise)
-ePassword is passed as env-var"SSHPASS"
With no parameters - password will be taken from stdin
-h            Showhelp(this screen)
-V            Print version information
At most one of-f,-d, -p or-eshould be used

你可能感兴趣的:(sshpass 的使用)