zoukankan      html  css  js  c++  java
  • 【原创】jssh linux scp ssh 免密登录开源工具

    项目名

    JSSH

    git地址:

    https://gitee.com/chejiangyi/jssh

    项目介绍

    linux scp(文件上传,下载) shell命令的java ssh jar和linux expect工具,主要是避免shell 密码手工输入带来的麻烦(免密ssh,scp),简单易用,方便上手

    软件架构

    jssh.jar 使用jsch封装的java版本
    jssh.sh 使用expect封装的sh版本

    以上两者是独立的,不同的实现。

    jssh.jar安装教程

    wget https://gitee.com/chejiangyi/jssh/raw/master/release/master/jssh.jar

    jssh.jar使用说明

    命令格式:java -jar jssh.jar [用户名]@[ip]:[端口]@[密码] [命令] [命令参数...]
    说明:
    [用户名] root
    [ip]10.200.133.69
    [端口]22
    [密码]cjy@@2018! (若@为转义,使用@@)
    [命令]sftp (枚举:shell,sftp)
    [参数]/root/setting.xml /root/setting.xml (根据命令指定参数)

    shell命令:
    支持 linux shell
    exit (表示退出shell)

    sftp命令:
    sftp [get(下载)/put(上传)] [来源文件路径 [目标文件路径]

    示范1(上传,下载同理):

    java -jar jssh.jar root@10.200.133.69:22@123456 sftp put c:/setting.xml /root/setting.xml

     

    示范2(shell):

    java -jar jssh.jar root@10.200.133.69:22@Fengdai@@2018! shell <<EOF
    cd /
    cat stream-mysql.log
    exit
    EOF

    jssh.sh安装教程

    yum install expect
    wget https://gitee.com/chejiangyi/jssh/raw/master/release/master/jssh.sh

    jssh.sh使用说明

    命令格式:expect jssh.sh [命令] [用户名]@[ip]:[fromfile] [tofile] [remotepassword]

    scp命令: expect jssh.sh scp [用户名]@[ip]:[fromfile] [tofile] [remotepassword]
    举例:

    expect jssh.sh scp root@10.200.133.50:tt.sql /tt.sql 111@2017!


    ssh命令:expect jssh.sh ssh [用户名]@[ip] [remotepassword]
    举例:

    expect jssh.sh ssh root@10.200.133.50 111@2017!

     

    by 车江毅

  • 相关阅读:
    二维数组求和
    mysql 常用函数
    3月17日 45道T-SQL查找 习题
    查询语句
    T-SQL 增删改查操作
    <转jerrylsxu> HTML语法大全
    1月25日 作业 多线程
    1月22日- 链表和哈希算法
    1月22日作业
    1月21日
  • 原文地址:https://www.cnblogs.com/chejiangyi/p/9212016.html
Copyright © 2011-2022 走看看