How can I convince z/OS scp to transfer binary fil

2020-07-11 06:49发布

问题:

We have SSH-based file transfer scripts currently set up for Linux-to-Linux and we're porting them to z/OS to go z/OS-to-Linux. Note that this is with USS, the UNIX system services within z/OS otherwise known as OMVS, which uses EBCDIC under the covers, not zLinux which uses ASCII.

We've set up all the SSH key files and what-not, and the transfer itself is working fine.

However z/OS, in it's infinite wisdom, insists on converting the files from EBCDIC to ASCII despite the fact that they're binary files - this is screwing up the content of the destination files.

The scp manpage on z/OS states:

scp assumes that files are text. Files copied between EBCDIC and ASCII platforms are converted.

and I can find nothing useful in the manuals that indicates how to get around this.

It seems a bizarre limitation for anyone wanting to transfer binary files between the two platforms. Does anyone know of a way, using SSH-standard keyfiles (we need this for security, no naked FTP allowed), to effect a binary transfer without translation?

回答1:

You can use one of the other SSH-based tools such as sftp.

Whereas scp will let you transfer a file (with automatic authentication set up) with something like:

scp -i ident_file zos_file linux_user@linux_box:linux_file

you can do a similar thing with the secure FTP:

sftp IdentityFile=ident_file -b - linux_user@linux_box <<EOF
    binary
    put zos_file linux_file
EOF