SSH_ASKPASS Variables

Discussion of the COZBATCH utility for z/OS
Post Reply
TSGHOS
Posts: 20
Joined: Fri Oct 15, 2010 8:55 am

SSH_ASKPASS Variables

Post by TSGHOS »

Hello,

We are in the process converting our FTP batch jobs to using COZBATCH.

The FTP job's read a dataset that contains the Host address,Userid and Password,which are then picked up by the FTP proc:

10.6.130.109
ftptsg s1lver22

Is it possible to use the exisitng dataset using the SSH_ASKPASS environment variable ? whereby we can pass the Userid and password,instead of the password only ?

Thanking you in advance.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

The SSH_ASKPASS variable is used by IBM Ported Tools OpenSSH to point to a Unix command or shell script to run. The output of this program must be a single line containing the password.

If you look at our sample JCL: RUNSFTP, you will see that we point to a shell script "read_passwd_dsn.sh" which reads from the dataset pointed to by $PASSWD_DSN.

If you are trying to reuse your existing datasets, in the exact syntax as you have described, you will have to write some of your own shell scripts to parse the dataset:

1) A replacement for "read_passwd_dsn.sh" that will echo the second word on the second line of the dastaset.
Here's a suggestion for such a shell script (put this in an executable HFS file):

Code: Select all

#! /bin/sh
coz_bin=`dirname $0`
"$coz_bin/fromdsn" -x shr "$PASSWD_DSN" | awk 'NR==2 {print $2}'
2) Some shell commands, perhaps inline, that read the ip address and username from the same dataset into variables that can be used on the cozsftp command line.

Code: Select all

server=$($coz_bin/fromdsn -x shr $PASSWD_DSN | awk 'NR==1 {print $1}' )
remoteuser=$($coz_bin/fromdsn -x shr $PASSWD_DSN | awk 'NR==2 {print $1}' )
TSGHOS
Posts: 20
Joined: Fri Oct 15, 2010 8:55 am

Post by TSGHOS »

Thank you for your prompt reply,will let you know how we get on.
Post Reply