美文网首页
sshpass使用

sshpass使用

作者: 只想做个俗人_贪财_好色 | 来源:发表于2023-04-16 13:47 被阅读0次

    通过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批量处理的时候 进行服务器授权

    相关文章

      网友评论

          本文标题:sshpass使用

          本文链接:https://www.haomeiwen.com/subject/hdwfjdtx.html