通过brew 安装 sshpass
brew install sshpass
如果上面方式不能安装 可以在本地创建 rb文件 文件名为sshpass.rb
require 'formula'
class Sshpass < Formula
url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz'
homepage 'http://sourceforge.net/projects/sshpass'
sha256 'c6324fcee608b99a58f9870157dfa754837f8c48be3df0f5e2f3accf145dee60'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make install"
end
def test
system "sshpass"
end
end
安装
brew install sshpass.rb
使用
sshpass -p <密码> ssh root@<ip>
通过这个方式可以方便在ansible批量处理的时候 进行服务器授权
网友评论