SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 22995: Passing a a user ID and password during a batch-submitted sign-on from a client to a remote host

DetailsAboutRate It

To pass a user ID and password during a batch-submitted sign-on and to suppress the prompt values, follow these steps:

  1. First, add macro variables in the script file for the user ID and password values, as shown in the following example. The macro variables are added via the TYPE statements in the example.
    /* --------------- TCP SIGNON --------------------------*/ waitfor 'Username:' , 'Hello>' : ready , 120 seconds : noprompt ; /* Input the macro variable ('USERID?) for the user ID';*/ type "&USERID" LF; waitfor 'Password:' , 120 seconds: nolog; /* Input the macro variable ('Password?') for a non-displaying password; */ type "&PASSWORD" LF; waitfor 'Hello>'
  2. After you edit the script file, create and submit the compiled DATA step, as follows, so that it stores the user ID and password but supresses the prompt for those values:
    data test/pgm=sasuser.uidpass; call symput('USERID','your-userid'); call symput('PASSWORD','your-password'); run;

When you need the user ID and password, submit the following program to run the compiled DATA step and execute the sign-on:

data pgm=sasuser.uidpass; run; filename rlink '!sasroot\connect\saslink\tcpwin.scr'; %let mynode=remote_ip_address; options comamid=tcp remote=mynode; signon;

Note: The SASUSER library is used because it is a private library under which you can use operating-system file protection to prevent access by other users. However, SASUSER can be used also as a shared read-only library. In addition, in a case where you invoke a second SAS session, it might be re-directed to the WORK library. In such a case, you need to amend the technique explained previously. In Windows environments, you can use the libref Mysas instead of Sasuser as the first level of the program name assigned by the PGM= option in the previous program. However, you must also add the following line at the top of your sasv9.cfg file:

-set mysas "?CSIDL_PERSONAL\My SAS Files\9.1"

When you use Mysas to point to this location (which is the same location to which Sasuser typically points), it is not subject to being redirected to the WORK library. Regardless of which library the uidpass.sas7bpgm file resides in, you should protect it from unauthorized Read access.




These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.