• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SCP task in Ant

 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Im trying to copy a file from one location to another using SCP task.

<scp file="log.txt" todir="user assword@host:/log" port="21"/>



But it is not getting copied.Instead it throws connect exception.In this case source and destination are in the same machine.

Can somebody help me on this?.

Thanks in advance..

Regards,
Priya.
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Priya Jothi:
Im trying to copy a file from one location to another using SCP task.

<scp file="log.txt" todir="user:password@host:/log" port="21"/>


Is it supposed to be localhost???

Originally posted by Priya Jothi:
In this case source and destination are in the same machine.
[/QB]


Why not use copy task?
 
Priya Jothi
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To start with a simple case i'm copying to a local machine.But in future i may change the host to refer to remote machine also.In that case also the same task need to be used instead of writing a new one.Thats why am using SCP instead of copy task.
 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Copies a file or FileSet to or from a remote machine running SSH daemon. FileSet only works for copying files from the local machine to a remote machine.



So, whether it's a local or remote machine you are expected to be running a SSH daemon. You aren't running anything that is listening on socket 21 hence the "Connection Refused" error.

Even if you were running an SSH daemon, it listens by default on port 22 (not port 21), SCP != FTP
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see that scp works for SSH2 protocol. I had issues using scp.
Since most of our security is based on SSH1, I started using exec to invoke scp.

Check below.

<exec dir="${anthome.dir}" executable="scp" output="scpROOT.dir">
<arg line=" -oProtocol=1 -i /home/tomcat/.ssh/identity /earlierBuilds/Build_99/${treeLabel}_ROOT.war tomcat@${Machine}:/usr/local/tomcat528/webapps/ROOT.war"/>
</exec>
 
reply
    Bookmark Topic Watch Topic
  • New Topic