Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
I'm trying out the SFPT Public Key Authentication Client. The client works fine, but for some reason it seems to be failing on changing directories. The SFTP password client works fine for changing directories.
Here is my code snippet
File privateKey = new File("/opt/local/test/.ssh/id_rsa");
SftpSubsystemClient sftp = null;
SshConnectionProperties properties = new SshConnectionProperties();
SshClient ssh = new SshClient();
ssh.connect(properties, new IgnoreHostKeyVerification());
PublicKeyAuthenticationClient pk = new PublicKeyAuthenticationClient();
SshPrivateKeyFile file = SshPrivateKeyFile.parse(privateKey);
SshPrivateKey key = file.toPrivateKey(ftpPassword);
int result = ssh.authenticate(pk);
SftpClient sftpClient = ssh.openSftpClient();
sftpClient.cd("/test/in/"); ** This line throws the exception. Please note the directories do exit and this client works if change directories in 2 steps like ..sftpClient.cd("/test/); and sftpClient.cd("/in/);
Does any one have a clue about this?
Any clue would be highly appreciated.
Thanks in advance,
Hi, I'd suggest you look for this problem in the j2ssh documentation - this is not related to code of this project but to the underlying j2ssh code.