BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JohnSimmons
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

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

3 REPLIES 3
Patrick
Opal | Level 21

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'>;

JohnSimmons
Calcite | Level 5

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;

JohnSimmons
Calcite | Level 5

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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