前提:安装Xcode Command Line
https://developer.apple.com/download/more/
下载Xcode Command Line =》安装
正文开始:
1、sshpass安装
直接用以下命令不行,会失败
brew install https://raw.githubusercontent.com/eugeneoden/homebrew/eca9de1/Library/Formula/sshpass.rb
#OR
brew install sshpass
用下面的命令可以安装sshpass
brew create http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.06.tar.gz --force
brew install sshpasss
2、sshpass使用
sshpass -p my_password ssh m_username@hostname
#例如
sshpass -p 123465 ssh ping@172.28.199.241
#跳过yes/no输入
sshpass -p 123465 ssh -o StrictHostKeyChecking=no ping@172.28.199.241