Pravin L - 2007-01-03


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/pegasus/.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();