BookmarkSubscribeRSS Feed
kingcu
Fluorite | Level 6

Hi folks,

 

I have been following the SAS documentation on this link , especially example 6 to the below code:

filename output sftp lsa
                     host="sftphost"
                     optionsx='pw "somepw"' user="userid" debug;

data temp;
    infile output truncover;
    input a $200.;;
run;

Basically, I am just trying to connect to the server and list all the files under the working directory, but I got the error message saying "ERROR: Directory or file ls -a w "somepw" userid@sftphost doesn't exist.". So, what am I missing here? 

7 REPLIES 7
ChrisNZ
Tourmaline | Level 20

Did you see these notes?

  • Note: Password validation is not supported for the SFTP access method.
  • Note: Public key authentication using an SSH agent is the recommended way to connect to a remote SSHD server.
  • Note: If you have trouble running the SFTP access method, try to manually validate SFTP client access to an OpenSSH SSHD server without involving the SAS system. Manually validating SFTP client access without involving the SAS system ensures that your SSH or SSHD configuration and key authentication is setup correctly.
Did you validate the connection without SAS using ssh?
kingcu
Fluorite | Level 6

I don't see any of those notes. I did validate the username and password using WinSCP client. 

ChrisNZ
Tourmaline | Level 20
These notes are on the page you mentioned. Validating the credentials is not enough, you need ssh.
kingcu
Fluorite | Level 6
Ok, I just tested this on Mac by using the sftp command line and I can log in the remote server with the same credential with no problem. And when I logged in, I type ls command and it listed all the folders and files there.
Kurt_Bremser
Super User

You must set up passwordless authentication with your local (on the SAS server) sftp client first, using a public/private keypair.

Since SAS uses an external sftp client which does not accept a password on the commandline (for security reasons, commandlines appear in the public process list), you cannot specify a password at all.

FILENAME FTP allows this because the whole FTP code is integrated within SAS.

Kurt_Bremser
Super User

The -pw (note the dash) option in example 6 specifies a pass phrase needed to open the .ppk file containing the private key. It is an option internal to WinSCP, and has nothing to do with an sftp password used to log on to a server.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 339 views
  • 1 like
  • 3 in conversation