/* SSH2FTP - Tunnel FTP connection
/*
/* Required environment variables are defined using
/* SSHENV DD card. Required variables are
/* _CEE_RUNOPTS=FILETAG(AUTOCVT,NOAUTOTAG),TRAP(ON)
/* _BPXK_AUTOCVT=ON
/*
/* ssh2 connects to remote server and creates local listener
/* for FTP to port 8888. Process ID is written to a file.
/*
/* Two FTP steps. FTP steps are configured to connect to
/* localhost port 8888.
/*
/* Last step stops the ssh2 connection and closes the tunnel.
/*
//SSH2 EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./scp2ftp_stdout',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDERR DD PATH='/home/&SYSUID./scp2ftp_stderr',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDENV DD DSN=USER1.SAMPLIB(SSHENV),
// DISP=SHR
//SYSTSIN DD *
BPXBATCH PGM /usr/lpp/ssh2/bin/ssh2 -S -f +
-oPidfile=/tmp/my_ssh2.pid +
-L ftp/8888:localhost:21 +
user@ftp_server
/*
//FTP EXEC PGM=FTP,PARM='localhost 8888 (EXIT=8'
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
username passwd
ascii
get ftp_test.txt 'USER.FTP.TEST'
quit
/*
//FTP EXEC PGM=FTP,PARM='localhost 8888 (EXIT=8'
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
username passwd
ascii
put 'USER.FTP.TEST2' result.txt
quit
/*
//SSH2STOP EXEC PGM=BPXBATCH,
// REGION=0M,
// TIME=NOLIMIT,
// PARM='SH kill `cat /tmp/my_ssh2.pid`'
//STDOUT DD PATH='/home/&SYSUID./ssh2stop_stdout',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDERR DD PATH='/home/&SYSUID./ssh2stop_stderr',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
/*
|