Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

scp command in command line step of the workflow

saurabh0201
Level 2
Level 2

Hi,

how to give scp command in command line step of workflow to copy a file from server.need to give username and password in the same command .

i have already tried the following commands :

scp ${file} USERNAME@pqrs.xyz.com desktop/xyz

scp ${file} USERNAME:'PASSWORD'@pqrs.xyz.com desktop/xyz

And getting the following exception :

org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:346)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:149)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:136)
    at com.day.cq.dam.core.process.CommandLineProcess.execute(CommandLineProcess.java:235)
    at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:93)
    at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:208)
    at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:140)
    at org.apache.sling.event.jobs.JobUtil$1.run(JobUtil.java:365)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)

but somehow i am not able to copy it .

please let me know if you have any idea about the respective issue. 

Regards,

Saurabh 🙂

1 Accepted Solution
Sham_HC
Correct answer by
Level 10
Level 10

There are various ways like Using public keys without a passphrase  OR sshpass Or Expect . Check with your network team they will help with exact command.

View solution in original post

3 Replies
Sham_HC
Level 10
Level 10

Refer scp documentation. The parameter supplier is wrong that the after hostname you will have colon with path and there is no space.

saurabh0201
Level 2
Level 2

hey sham,

Thank you for your reply , it will be very helpful if you could give syntax  for it .

Regards,

Saurabh

Sham_HC
Correct answer by
Level 10
Level 10

There are various ways like Using public keys without a passphrase  OR sshpass Or Expect . Check with your network team they will help with exact command.