Using GNU Screen and Zmodem (rz/sz) to Transfer Files via a Jump Host
This guide explains how to use the GNU Screen terminal with Zmodem's rz and sz commands to manually transfer files from a local Linux environment to a remote test machine through a jump host that only allows SSH access.
Background
In some cases we need to manually copy code to a test machine; the code resides locally on a Linux environment without advanced tools like SecureCRT.
Access to the test machine must go through a jump host.
The jump host only provides the ssh command.
Solution
After researching, we discovered that any terminal supporting the Zmodem protocol can provide the same functionality as SecureCRT's rz / sz . In a Linux environment, the most natural Zmodem‑compatible terminal is screen . The procedure is as follows:
rz (receive file on remote host)
Start a screen session on the local host.
Configure screen to “catch” Zmodem traffic (press CTRL-A then type :zmodem catch and press ENTER ).
Execute rz from the command line (no filename needed).
When screen prompts with the default send command, add the local filename and press ENTER .
The file is now available on the remote host.
sz (send file from remote host)
Start a screen session on the local host.
Configure screen to “catch” Zmodem traffic (press CTRL-A then type :zmodem catch and press ENTER ).
Execute sz FILE from the command line, where FILE is the file you want to transfer.
When screen shows the default receive command, press ENTER .
The file is now available on the local host.
Reference
GNU Screen and Zmodem: http://adammonsen.com/post/256
Author: Liu Yue, Head of Hotel Business Unit Technical Team, Qunar.
Qunar Tech Salon
Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.