I have a jar file containing a javadoc tree on one box. I need to transfer it to another box and unpack the jar in a specific directory (which may not exist).

I have the username/password of the principal I want to use to log into the remote box, but I don't have an ssh key to use.

I might be able to use expect to make this work, but I'd like to see if I could do it entirely with curl. I was successfully able to transfer the jar file to the remote box using a command like this:

curl -k -T file.jar -u user:password scp://host/path/file.jar

The harder part of the requirements is unpacking the jar, or somehow unpacking from the source through stdout into the pipe to unpack it on the remote. For that, I tried the following:

gzip -c file.jar | curl -k -T - -u user:password scp://host/path/stuff

This fails with "curl: (25) SCP requires a known file size for upload".

Should I just go for the full "expect" implementation to make this all work? I haven't even thought about whether it's possible for curl to create the destination directory if it doesn't exist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.