【发布时间】:2014-01-18 13:47:24
【问题描述】:
我正在使用 SSHJ 库建立反向 ssh 隧道但没有运气..
Error: Unable to resolve host name
使用的代码:
final SSHClient ssh = new SSHClient(new AndroidConfig());
Command cmd = null;
// Adds a nullHostKeyVerifier
ssh.addHostKeyVerifier(new NullHostKeyVerifier());
// default port number
int pn = 22;
// connect to the machine
try {
String pemkey = "/mnt/sdcard/lamp.pem";
ssh.loadKeys(pemkey);
ssh.connect("-R 8080:localhost:8080 root@54.X.X.X ",pn);
// Authenticate with the password entered
// start a new session
final Session session = ssh.startSession();
} catch (IOException e) {
Log.e("message", e.getMessage(), e);
}
【问题讨论】:
-
connect只接受一个主机名,例如ssh.connect("54.X.X.X");这种反向隧道我不知道怎么做。