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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 870 views
  • 1 like
  • 3 in conversation