ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Atsuhiko Yamanaka" <y...@jcraft.com>
Subject Re: ANT SCP Via a Java App
Date Tue, 09 May 2006 17:00:12 GMT
Hi,

2006/5/9, Gareth Kelly <Gareth.Kelly@davy.ie>:
> 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("nettrade@laois <mailto:nettrade@laois>
> :" + 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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message