我尝试使用jcabi库将ssh连接到远程ubuntu服务器。
我使用以下代码示例
String host = "XX.XX.XX.XX";
String user = "myuser";
String key = "C:\path\to\the\pem\folder\relevantFile.pem"
String pwd = new Shell.Plain(
new Ssh(host, 22,
user, key
)
).exec("pwd");
System.out.println(hello);
当试图运行代码时(它在@Test类BTW中)我收到以下错误:
Caused by: java.io.FileNotFoundException: C:\....\AppData\Local\Temp\jcabi-ssh201869605540056323.key (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileInputStream.open0(Native Method)
我还尝试设置key
文件中的pem
内容,但异常是相同的。