Hi,
Not sure if this is the correct mailing list, but hopefully someone can help
me.
I have been using the ant and ant-jsch.jar in a java app to scp files from
one machine to another.
 
Works fine when passing in username and password.
I set up a trusted connection by creating a public/private key pair and
appending the identity.pub to the remote authorized_keys.
Now I can scp a file from the command line without a password.
 
But when I try to do this from the java app, i get the following error:
 
neither password nor passphrase for user nettrade has been given.  Can't
authenticate.
        at
org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:166)
        at GetReutersKey.scpFile(GetReutersKey.java:346)
        at GetReutersKey.main(GetReutersKey.java:65)
Caused by: neither password nor passphrase for user nettrade has been given.
Can't authenticate.
        at
org.apache.tools.ant.taskdefs.optional.ssh.Scp.parseUri(Scp.java:254)
        at
org.apache.tools.ant.taskdefs.optional.ssh.Scp.upload(Scp.java:223)
        at
org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:155)
        ... 2 more
--- Nested Exception ---
neither password nor passphrase for user nettrade has been given.  Can't
authenticate.
        at
org.apache.tools.ant.taskdefs.optional.ssh.Scp.parseUri(Scp.java:254)
        at
org.apache.tools.ant.taskdefs.optional.ssh.Scp.upload(Scp.java:223)
        at
org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:155)
        at GetReutersKey.scpFile(GetReutersKey.java:346)
        at GetReutersKey.main(GetReutersKey.java:65)

This is my code:
 
            Scp scpConnection = new Scp();
            Project project = new Project();
            scpConnection.setFile(aSFile);
            scpConnection.setTrust(true);
            scpConnection.setTodir("[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
:" + aSDir);
            scpConnection.setProject(project);
            scpConnection.execute();

 
Any ideas?
 
Thanks,
Gareth


The information in this e-mail is confidential and may be legally privileged. 
It is intended solely for the addressee. Access to this e-mail by anyone else 
is unauthorised. If you are not the intended recipient, any disclosure, 
copying, distribution or any other action taken or any views, opinions or 
advice contained in this e-mail are those of the sending individual and not 
necessarily those of the firm. It is possible for data transmitted by e-mail to 
be deliberately or accidentally corrupted or intercepted. For this reason where 
the communication is by e-mail, J&E Davy does not accept any responsibility for 
any breach of confidence which may arise from the use of this medium. If you 
have received this e-mail in error please notify us immediately at 
mailto:[EMAIL PROTECTED] and delete this e-mail from your system.

Reply via email to