天天看点

【原创】jssh linux scp ssh 免密登录开源工具

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

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

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

jssh.sh 使用expect封装的sh版本

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

命令格式: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(上传,下载同理):

示范2(shell):

【原创】jssh linux scp ssh 免密登录开源工具

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

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

举例:

【原创】jssh linux scp ssh 免密登录开源工具

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

【原创】jssh linux scp ssh 免密登录开源工具

by 车江毅

开源是一种态度,分享是一种精神,学习仍需坚持,进步仍需努力,.net生态圈因你我更加美好。