私钥连接sftp
终端连接:
sftp -oIdentityFile=/Users/tingyu/Desktop/id_rsa_sandbox -oPort=2222 lm_juduoduo_partner_pay@120.92.15.135
///Users/tingyu/Desktop/id_rsa_sandbox -oPort—私钥文件路径
下载文件:
get -r /home/data /home/my
get -r nstruction.txt /Users/tingyu/Desktop/mi0223
删除文件:
rm
rmdir
Java连接时注意
私钥文件路径添绝对路径
jsch.addIdentity(privateKey);// 设置私钥
prvkey = Util.fromFile(prvfile);
File file = new File(_file);
FileInputStream fis = new FileInputStream(_file);
用System.out.println(new File(".").getAbsolutePath());打印了一下当前目录
1957

被折叠的 条评论
为什么被折叠?



