Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

SAS Sftp connection issue

Currently I'm trying to use sas to connect to sftp server. I did some researches, it said in order to use sftp method, I need to install openSSH client software and use key authentication for connection.

So I installed puTTY and setup the private/public key. When I test the connection from psftp, I can connect to sftp server without password (use key authentication). As you can see as below, the test file 3.xlsx is on the sftp server. enter image description here

But the problem is when I try to get the same file on sas, it has an error "the file does not exist". enter image description here

Inside psftp, I could download this test file on my local pc, I have no idea why I cant do the same thing on sas.

Below is my sas sftp connection code:

filename output sftp '/3.xlsx'
optionsx='-P 222 -i x:PuTTYprivatekey.ppk -pw "XXXXX" -V'
host="xxxxxx" user="xxxxxxx" path="x:PuTTYpsftp.exe" DEBUG;

I would be so appreciate if someone can help me to fix this issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The first thing I'd troubleshoot is whether your prompt is an issue. According to the documentation:

SFTP Access Methods and SFTP Prompts The SFTP access method supports only the following prompts. Changing the prompt will disable the SFTP access method. For OpenSSH:

  • sftp>
  • sftp >

You have psftp>. That could be a problem.

The second thing I'd try is, also from the documentation, example 4: Using a Batch File. Their example:

 filename process sftp ' ' host="linuxhost1" user="userid" 
   batchfile="c:/stfpdir/sftpcmds.bat";
data _null_;
   infile process;
run;

That would allow you to do more troubleshooting, at minimum (such as a ls to see what's available). There's a lot of potential issues you may be running into, so being able to debug with a commands file would help resolve at least some of them.

You do have the LS and LSA options, as well, which might help at least debug a bit - maybe easier than the commands file at first.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...