Giter VIP home page Giter VIP logo

javaautosshpasswordfree's Introduction

JavaAutoSshPasswordFree

Java 自动配置 Linux 节点间的 SSH 免密登录

  • 支持幂等执行(会先删除之前的~/.ssh

使用

要求所有节点都配置了 Hosts,可以互相访问。

  1. jar包获取
  • 使用 assembly 打包出来的jar包
  • 或从 Release 页面下载
  1. 执行
  • 将 java-auto-ssh-password-free-core-1.0.0.jar 放到某个目录
  • 执行 java -cp . org.xliu.cs.projects.sshpasswordfree.Main $username $password $host_file

说明:

  • $username : 用户名
  • $password :密码,如果是通用密码,则设置,如果每个节点密码不一样,则该值随意设置(必须设置)
  • $host_file : 主机文件,形式如下
# 节点和密码,用空格分隔
node131 password1
node131 password1
# 如果该节点是通用密码,则密码部分可以不填
node131

原理

Step 1:针对所有节点生成 RSA 密钥(会先删除存在的~/.ssh目录), 生成id_rsa, id_rsa.pub

Step 2: 进行密钥分发,生成 authorized_keys

Step 3: 访问节点,生成 known_hosts (避免 StrictHostKeyChecking)

javaautosshpasswordfree's People

Contributors

xliuqq avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.