Reference : [1]
step1 : install sshpass
对于Mac,您需要安装xcode和命令行工具,然后使用非官方的Homewbrew命令:
$ brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
step 2 : use it.
$ sshpass -p my_password ssh m_username@hostname
这里有关于如何安装sshpass的说明:
https://gist.github.com/arunoda/7790979