SCP Transfer

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

SCP Transfer

Good afternoon SAS Community,

I try not to bug you guys unless I'm banging my head up against a wall, but I'm having difficulty with this one as I am not quite sure what to put into a search engine to bring this sort of thing up.

I got my RSA keys generated and placed in the proper place. If I copy the shell command without the quotes or the X and paste it into the command prompt on the UNIX server, it works perfectly, I can go out to the ftp transport site and see the file.

rsubmit;

    x "scp -i /home/user/<myusername>/.ssh/<mykey> /<ourdirectory>/TESTFILE.01 <mylogin>@<anftpaddress>.com:TESTFILE.01"

endrsubmit;

signoff;

When I run this code, however, it just states "Running..." in the task status window and never seems to resolve.

Could anyone point me to either an article that would help me or tell me what I'm doing wrong?  Shell commands are turned on from our SAS administrator.

Thanks for any help you can provide, I very much appreciate it!

John

EDIT: 

    Forgot to mention, anything in the code within <> is replaced to mask aspects of business and all.  I'm not submitting it with those.

Message was edited by: John Simmons


Accepted Solutions
Solution
‎04-24-2013 08:44 PM
Respected Advisor
Posts: 3,900

Re: SCP Transfer

I'm assuming that you're using the same user for executing the command in the command prompt and under SAS.

You are using double quotes around your command. Are there any macro tokens like '%' or '&' in the bits you can't show us - eg. in <mykey>? Also stuff like double quotes and control characters would cause issues.

And then.... You need to terminate an x command with a ';'. I can't see this in the code you've posted.

X <'operating-environment-command'>;

View solution in original post


All Replies
Solution
‎04-24-2013 08:44 PM
Respected Advisor
Posts: 3,900

Re: SCP Transfer

I'm assuming that you're using the same user for executing the command in the command prompt and under SAS.

You are using double quotes around your command. Are there any macro tokens like '%' or '&' in the bits you can't show us - eg. in <mykey>? Also stuff like double quotes and control characters would cause issues.

And then.... You need to terminate an x command with a ';'. I can't see this in the code you've posted.

X <'operating-environment-command'>;

Contributor
Posts: 23

Re: SCP Transfer

Good afternoon Patrick,

Thank you for the help:

I originally thought it could be one of my variables, so I stripped all of them out and used explicit calls of both paths and files, to the point that I can copy exactly what is in the quotes into the UNIX command line and it works fine.

The ; was just from my re-writing the code here, it is there.

The double quotes being used is because originally, I had it wrapped up in a macro to allow me to use this piece of code again and again, but have since pulled it out of that so I could test it and just get it to work once.  Ideally, when I get this working, I would be expecting to run this with variables pushed in for filenames and such.

Finally, the user ID I'm using in SAS is the same I used to generate the keys and log into the UNIX server to test the command.

So just to clean it up:

rsubmit;

  X "SCP -i /home/user/myuserid/MY_PRIVATE_KEY /myunixdirectory/TESTFILE.07 mylogin@ourftpsite.com:TESTFILE.07";

endrsubmit;

signoff;

Contributor
Posts: 23

Re: SCP Transfer

Apparently it was my SAS job that got hung up, probably on one of my previously failed attempts.  My guess is that it was waiting for a password, not being able to accept my key location and when I stopped the "Running..." job, it never did the signoff or endrsubmit, causing my whole job to become corrupted with my lack of knowledge.

So!  I rebuilt my SAS EG file, re-ran the code and it worked perfectly.

My apologies and Patrick, thank you for your help, this one is chalked up to my being too bullheaded about it.

Thanks again!

John

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 1277 views
  • 0 likes
  • 2 in conversation