Hi,
I have an issue when I try to connect to a sftp server in SAS. I can connect to the sftp server in Linux without problems doing this:
su test /*insert pass*/ cd /xxxx/sas/tmp/fort/files sftp -oIdentityFile=/home/xxxx/.ssh/key_sftp xxxx_sftp@servergin01.western.world:/dpor/port/high/KBV put /xxxx/sas/tmp/fort/files/google_01.html put /xxxx/sas/tmp/fort/files/gwrwe_02.png exit
But If I execute this I can't see the new files:
x "su test";
x "/*insert pass*/";
x "cd /xxxx/sas/tmp/fort/files"; x "sftp -oIdentityFile=/home/xxxx/.ssh/key_sftp xxxx_sftp@servergin01.western.world:/dpor/port/high/KBV"; x "put /xxxx/sas/tmp/fort/files/google_01.html"; x "put /xxxx/sas/tmp/fort/files/google_01.png"; x "exit";
I tried to execute a mv command with SAS and works fine. Maybe SAS can't connect to the server?...
Regards.
You cannot do it that way. (You might not be able to do it at all if it requires you to pretend to be a live person and type a password). Each X command is going to run in another unix shell instance. So the 'put" statement is not going to work because the new shell where it is running does not have the sftp command running.
Create a shell script and use the X command to run the shell script.
Use scp instead of sftp. Use a separate scp command to copy each file. Then you are running just one the self contained command.
If you really must use sudo to have access to read the files you want to transfer then I think you will have a big problem. And if you don't need it then why did you include it?
Read @Tom 's reply again. There's no mention of a filename.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.