Hi, 2006/5/9, Gareth Kelly <[EMAIL PROTECTED]>:
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.
The internal ssh client can not understand ssh1 public/private key. So, generate key pair by "ssh-keygen -t rsa" or "ssh-keygen -t dsa" and you will have key-pair like "id_dsa, id_dsa.pub" or "id_rsa,id_rsa.pub". And, you have to set its private key explicitly with setKeyfile method.
Scp scpConnection = new Scp(); Project project = new Project(); scpConnection.setFile(aSFile);
scpConnection.setKeyfile("/home/nettrade/.ssh/id_dsa"); then, you must set something as a passphrase even if it is not encrypted, because there is a bug. scpConnection.setPassphrase("");
scpConnection.setTrust(true); scpConnection.setTodir("[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> :" + aSDir); scpConnection.setProject(project); scpConnection.execute();
Dear developers, to resolve above bug, following lines in org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
if (getUserInfo().getPassword() == null && getUserInfo().getPassphrase() == null) { throw new BuildException("neither password nor passphrase for user" + getUserInfo().getName() + " has been " + "given. Can't authenticate."); } should be if (getUserInfo().getPassword() == null && (getUserInfo().getPassphrase() == null && getUserInfo().getKeyfile()==null)) { throw new BuildException("neither password nor passphrase for user" + getUserInfo().getName() + " has been " + "given. Can't authenticate."); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]