Note: This FTP server was originally written by Jason Winter and Juergen Winkelmann.
This FTP daemon requires RAKF to run. You must install RAKF for this FTP server to work.
If you're using MVS/CE you can install this with
the command RX MVP INSTALL FTPD
. Once completed you can start the FTPD server on port
2121 in the hercules console with /S FTPD
.
❗ If you're not using MVS/CE you should follow the manual install.
/s ftpd
/ $HASP100 FTPD ON STCINRDR
/ $HASP373 FTPD STARTED
/ IEF403I FTPD - STARTED - TIME=23.05.01
/ +FTP000I Startup - FTPD Starting with 1 arguments
/ +FTP002I Startup - Reading parmlib SYS1.PARMLIB(FTPDPM00)
/ +FTP001I Startup - Parameter SRVPORT = '2121'
/ +FTP001I Startup - Parameter SRVIP = 'ANY'
/ +FTP001I Startup - Parameter PASVADR = '127,0,0,1'
/ +FTP001I Startup - Parameter AUTHUSER = 'IBMUSER'
/ +FTP001I Startup - Argument (1) DD Name AAINTRDR added
/ +FTP002I Startup - Reading 5 DASD
/ +FTP003I Startup - Reading DASD MVSRES,3350
/ +FTP003I Startup - Reading DASD MVS000,3350
/ +FTP003I Startup - Reading DASD PUB000,3380
/ +FTP003I Startup - Reading DASD PUB001,3390
/ +FTP003I Startup - Reading DASD SYSCPK,3350
/ +FTP004I Startup - 173 datasets
/ +FTP005I Startup Complete - FTP server listening on port: 2121
Using this install everyone in the RAKF group ADMIN
has access to use FTP. To allow users
access to FTP add the user or group to the FTPAUTH resource in the FACILITY class
in SYS1.SECURE.CNTL(PROFILES)
. Adding the example below would allow anyone in the
USERS group access to FTP:
FACILITYFTPAUTH USERS READ
❗ When adding RAKF profiles they must be in alphabetical order
Startup/Shutdown
To start the FTPD server after IPL run the command /s ftpd
in the hercules console. To stop the FTP
server run the command /p ftpd
or /stop ftpd
on the hercules console. To make changes to the configuration (ports, IP etc)
you can edit the config file SYS1.PARMLIB(FTPDPM00)
.
Custom Configuration File
If you want to use a custom configuration file you can use edit the procedure SYS2.PROCLIB(FTPD)
and replace this:
//FTPD EXEC PGM=FTPDXCTL,TIME=1440,REGION=8192K
with this, adding your own parmlib:
//FTPD EXEC PGM=FTPDXCTL,TIME=1440,REGION=8192K,
// PARM='PARMLIB=PLACE.WITH.PARMLIBS(FTPPARMS)'
FTPD Arguments
FTPD can take several arguments. These arguments override whatever the setting is in the configuration file and they
can be in any order. To use them in JCL you use the PARM=
field. For example, to use port 54321 and change the
ip address the server listens on your JCL would look like:
//FTPD EXEC PGM=FTPDXCTL,TIME=1440,REGION=8192K,
// PARM='SRVIP=192.168.0.5 SRVPORT=54321'
The following arguments are supported:
- SRVPORT - The port that the FTPD server will listen on.
- SRVIP - The IP address of the hercules host machine to listen on. The default is 'any' which is the equivalent of 'all' or '0.0.0.0'.
- PASVADR - IP address to return for passive mode, comma separated. The default is '127,0,0,1'. This address is used only if getsockname doesn't return a suitable value.
- FAST - When set to
TRUE
Library Optimisation Extensions are enabled - AUTHUSR - If set, this user can use
quote term
/quote terminate
to shutdown the FTP server remotely - DD - The name of a required DD name in the JCL. Currently used for an internal reader.
The procedue FTPDPARM
has been installed which allows for the argument SRVPORT
and AUTHUSR
.
See BUILD.md for instructions how to build from source.
Upload the XMI file FTPD.XMI
and receive the file with RECV370 (modify the JCL as needed).
//RECVFTPD JOB (TSO),'Recieve XMI',CLASS=A,MSGCLASS=A
//* RECV370 DDNAMEs:
//* ----------------
//*
//* RECVLOG RECV370 output messages (required)
//*
//* RECVDBUG Optional, specifies debugging options.
//*
//* XMITIN input XMIT file to be received (required)
//*
//* SYSPRINT IEBCOPY output messages (required for DSORG=PO
//* input datasets on SYSUT1)
//*
//* SYSUT1 Work dataset for IEBCOPY (not needed for sequential
//* XMITs; required for partitioned XMITs)
//*
//* SYSUT2 Output dataset - sequential or partitioned
//*
//* SYSIN IEBCOPY input dataset (required for DSORG=PO XMITs)
//* A DUMMY dataset.
//*
//RECV370 EXEC PGM=RECV370
//STEPLIB DD DISP=SHR,DSN=SYSC.LINKLIB
//* Change DSN to match where you uploaded the file
//XMITIN DD DISP=SHR,DSN=USERNAME.FTPDLOAD.XMI
//RECVLOG DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//* Work temp dataset
//SYSUT1 DD DSN=&&SYSUT1,
// UNIT=VIO,
// SPACE=(CYL,(5,1)),
// DISP=(NEW,DELETE,DELETE)
//* Output dataset
//SYSUT2 DD DSN=SYSGEN.FTPD.LOADLIB,
// UNIT=SYSALLDA,VOL=SER=PUB001,
// SPACE=(CYL,(15,2,20),RLSE),
// DISP=(NEW,CATLG,DELETE)
Inside the XMI file is FTPD
, and FTPDXCTL
, you need to copy them to your
link library (most likely SYS2.LINKLIB
):
//FTPXMIT1 JOB (TSO),'Recieve XMI',CLASS=A,MSGCLASS=A
//STEP2CPY EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//* Make sure the SYSUT2 DSN matches where you
//* receive the XMI file above
//SYSUT1 DD DSN=SYSGEN.FTPD.LOADLIB,DISP=SHR
//SYSUT2 DD DSN=SYS2.LINKLIB,DISP=SHR
//SYSIN DD *
COPY INDD=((SYSUT1,R)),OUTDD=SYSUT2
Then install/place the following FTPD procedures in SYS2.PROCLIB
:
This launches FTPD with the config file located at SYS1.PARMLIB(FTPDPM00)
(the default).
//FTPDPROC EXEC PGM=IEBGENER
//SYSUT1 DD DATA,DLM=@@
//FTPD PROC
//********************************************************************
//*
//* MVS3.8j RAKF Enabled FTP server PROC
//* To use: in Hercules console issue /s FTPD to start FTP server
//*
//* To change settings edit config file SYS1.PARMLIB(FTPDPM00)
//*
//********************************************************************
//FTPD EXEC PGM=FTPDXCTL,TIME=1440,REGION=4096K,
// PARM='DD=AAINTRDR'
//AAINTRDR DD SYSOUT=(A,INTRDR),DCB=(RECFM=FB,LRECL=80,BLKSIZE=80)
//STDOUT DD SYSOUT=*
@@
//SYSUT2 DD DISP=SHR,DSN=SYS2.PROCLIB(FTPD)
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
This launches FTPD with but allows the defaults and config file entries for SRVPORT
and AUTHUSER
to be overridden. For example,
/s ftpdparm,srvport=54321
//FTPDPARM EXEC PGM=IEBGENER
//SYSUT1 DD DATA,DLM=@@
//FTPDPARM PROC SRVPORT='2121',AUTHUSR='IBMUSER'
//********************************************************************
//*
//* MVS3.8j RAKF Enabled FTP server PROC with custom arguments
//* To use: in Hercules console issue
//* /s FTPDPARM,srvport=54321
//*
//********************************************************************
//FTPD EXEC PGM=FTPDXCTL,TIME=1440,REGION=4096K,
// PARM='SRVPORT=&SRVPORT DD=AAINTRDR AUTHUSER=&AUTHUSR'
//AAINTRDR DD SYSOUT=(A,INTRDR),DCB=(RECFM=FB,LRECL=80,BLKSIZE=80)
//STDOUT DD SYSOUT=*
@@
//SYSUT2 DD DISP=SHR,DSN=SYS2.PROCLIB(FTPDPARM)
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
Before proceeding you need to also make changes to RAKF and parmlibs
You must add the FTPD user and group to RAKF in SYS1.SECURE.CNTL(USERS)
RANDOM
❗ RAKF users must be in alphabetical sort order
# User Group
FTPD FTPD RANDOM N
Then update rakf from the hercules console with /s rakfuser
.
You also need to approve the group FTPD to have access to SVC244 by
adding the following to SYS1.SECURE.CNTL(PROFILES)
FACILITYSVC244 FTPD READ
You also need to add the FTPAUTH
resource to the facility class. The
lines below block access to anyone not in the ADMIN group.
❗ RAKF profiles must be in alphabetical order (i.e. FTPAUTH should follow DIAG8)
FACILITYFTPAUTH NONE
FACILITYFTPAUTH ADMIN READ
Then update rakf from the hercules console with /s rakfprof
Copy the file FTPD.conf
to SYS1.PARMLIB(FTPDPM00)
You're all setup now you can launch FTPD with /s ftpd
and read the messages on the hercules console
All of the above steps have been placed in the file install.jcl
. Just make sure the datasets are correct
and you can submit this JCL after uploading the XMI file.