table of contents
| RZ(1) | General Commands Manual | RZ(1) |
NAME¶
rx, rb, rz - XMODEM, YMODEM, ZMODEM (Batch) file receive
SYNOPSIS¶
rz [- +abeOpqRtuUvy]
rb [- +abqRtuUvy]
rx [- abceqRtuUv] file
[-][v]rzCOMMAND
DESCRIPTION¶
This program uses error correcting protocols to receive files over a dial-in serial port from a variety of programs running under PC-DOS, CP/M, Unix, and other operating systems. It is invoked from a shell prompt manually, or automatically as a result of an "sz file ..." command given to the calling program.
Rz (Receive ZMODEM) receives files with the ZMODEM batch protocol. Pathnames are supplied by the sending program, and directories are made if necessary (and possible). Normally, the "rz" command is automatically issued by the calling ZMODEM program, but some defective ZMODEM implementations may require starting rz the old fashioned way.
Rb receives file(s) with YMODEM, accepting either standard 128 byte sectors or 1024 byte sectors (lsb -k option). The user should determine when the 1024 byte block length actually improves throughput without causing lost data or even system crashes.
If True YMODEM (Omen Technology trademark) file information (file length, etc.) is received, the file length controls the number of bytes written to the output dataset, and the modify time and file mode (iff non zero) are set accordingly.
If no True YMODEM file information is received, slashes in the pathname are changed to underscore, and any trailing period in the pathname is eliminated. This conversion is useful for files received from CP/M systems. With YMODEM, each file name is converted to lower case unless it contains one or more lower case letters.
Rx receives a single file with XMODEM or XMODEM-1k protocol. The user should determine when the 1024 byte block length actually improves throughput without causing problems. The user must supply the file name to both sending and receiving programs. Up to 1023 garbage characters may be added to the received file.
Rz may be invoked as rzCOMMAND (with an optional leading - as generated by login(1)). For each received file, rz will pipe the file to ``COMMAND filename'' where filename is the name of the transmitted file with the file contents as standard input.
Each file transfer is acknowledged when COMMAND exits with 0 status. A non zero exit status terminates transfers.
A typical use for this form is rzrmail which calls rmail(1) to post mail to the user specified by the transmitted file name. For example, sending the file "caf" from a PC-DOS system to rzrmail on a Unix system would result in the contents of the DOS file "caf" being mailed to user "caf".
On some Unix systems, the login directory must
contain a link to COMMAND as login sets SHELL=rsh which disallows absolute
pathnames. If invoked with a leading ``v'', rz will be verbose (see
v option). The following entry works for Unix SYS
III/V:
rzrmail::5:1::/bin:/usr/local/rzrmail
If the SHELL environment variable includes rsh , rbash or
rksh (restricted shell), rz will not accept absolute pathnames
or references to a parent directory, will not modify an existing file, and
removes any files received in error.
If rz is invoked with stdout and stderr to different datasets, Verbose is set to 2, causing frame by frame progress reports to stderr. This may be disabled with the q option.
OPTIONS¶
The meanings of the available options are:
- -+, --append
- append received data to an existing file (ZMODEM, ASCII only).
- -a, --ascii
- Convert files to Unix conventions by stripping carriage
returns and all characters beginning with the first Control Z (CP/M end of
file).
Deprecated: this uses the ZCNL file conversion option, which current ZMODEM documentation marks as historic and recommends against. ASCII conversion also makes a transfer impossible to resume. It is kept for compatibility with 40 year old peers, but new setups should transfer in binary mode and convert locally if needed.
Note: for compatibility with old senders, a file mode sent with the file metadata that includes file type bits (the historical full st_mode) silently forces binary transfer for that file, overriding this option, and disables the lower-casing of received file names. This legacy behavior is deprecated as well and will likely be removed in a future release.
- -A, --segmentsize NNNN
- Tell the sender to turn on `Segmented Streaming' with a buffer / window of
NNNN bytes. If the sender supports it, it will ask for an ZACK packet
every NNNN bytes. This somewhat limits throughput on perfect lines, and
can vastly improve performance on faulty lines.
NNNN can range from 0 to 65535 (this is a protocol limitation). '0', the default, tells the sender that the receiver does not wish to use segmentation. Note that `lsz', the sending program of this package, does then use its own default of 16kb.
Support for segmented streaming is not universal.
- -b, --binary
- Binary (tell it like it is) file transfer override.
- -B NUMBER, --bufsize NUMBER
- Buffer NUMBER bytes before writing to disk. Default is 32768, which should be enough for most situations. If you have a slow machine or a bad disk interface or suffer from other hardware problems you might want to increase the buffersize.
- -c, --with-crc
- XMODEM only. Use 16 bit CRC (normally a one byte checksum is used).
- -D, --null
- Output file data to /dev/null; for testing. (Unix only)
- --delay-startup N
- Wait N seconds before doing anything.
- -e, --escape
- Force sender to escape all control characters; normally XON, XOFF, DLE, CR-@-CR, and Ctrl-X are escaped.
- -E, --rename
- Rename incoming file if target filename already exists. The new file name will have a dot and a number (0..999) appended. (ZMODEM and YMODEM only)
- -h, --help
- give help screen.
- -H, --crc-check
- (ZMODEM only; not usable with YMODEM, which lacks the required protocol exchange) Accept and transfer files if the file lengths and/or the CRCs differ.
- -J FILE, --journal FILE
- Append a transfer-statistics line to FILE for each file received. The line consists of key=value pairs including timestamp, direction (dir=rx), filename, status, byte counts, duration, and throughput. The file is created if it does not exist and appended to on each invocation.
- -m N, --min-bps N
- Stop transmission if BPS-Rate (Bytes Per Second) falls below N for a certain time (see --min-bps-time option). The check is per file: the timer resets at the start of each file.
- -M N, --min-bps-time
- Used together with --min-bps. Default is 120 (seconds). The timeout is per file: a slow transfer of one file does not count toward the next file's timeout.
- -n, --newer
- (ZMODEM and YMODEM) Accept file if the destination file does not exist. Otherwise, accept the file, overwriting the destination, if the source file is newer than the destination file.
- -N, --newer-or-longer
- (ZMODEM and YMODEM) Accept file if the destination file does not exist. Otherwise, accept the file, overwriting the destination, if the source file is newer or longer than the destination file.
- -O, --disable-timeouts
- Disable read timeout handling code. This makes lrz hang if the sender does
not send any more, but increases performance (a bit) and decreases system
load (through reducing the number of system calls by about 50 percent).
Use this option with care.
- --o-sync
- Open output files in synchronous write mode. This may be useful if you
experience errors due to lost interrupts if update (or bdflush or whoever
this daemon is called on your system) writes the buffers to the disk.
This option is ignored and a warning is printed if your systems doesn't support O_SYNC.
- -p, --protect
- (ZMODEM) Protect: skip file if destination file exists.
- -q, --quiet
- Quiet suppresses verbosity.
- -r, --resume
- Crash recovery mode. lrz tries to resume interrupted file transfers.
- -R, --restricted
- Enter the very restricted mode. lrz will not create directories or files
with a leading dot, and will not overwrite any existing file. This option
always enables the very restricted mode, even if it was downgraded before
(e.g. by combining it with the ZMODEM_RESTRICTED environment
variable).
See SECURITY for the security model and the description of the restricted levels.
- --keep-incomplete
- Keep partially received files when a transfer fails with an error. The default is to remove incomplete files; this option is the opt-in for keeping them, e.g. to --resume the transfer later, or when receiving on a private system where the partial data is worth more than the disk space. Interrupted transfers (Ctrl-C, modem hangup) always keep the partial file.
- -s HH:MM, --stop-at HH:MM
- Stop transmission at HH hours, MM minutes. Another variant, using +N instead of HH:MM, stops transmission in N seconds. The deadline is tracked with a one-second granularity because of the way the check is implemented (the N argument is parsed before any data flows and compared against integer seconds afterwards); the transfer stops during the second after the deadline is reached, so a transfer stops within about N+1 to N+2 seconds.
- --syslog[=off]
- turn syslogging on or off. Syslog is on by default.
- -t TIM, --timeout TIM
- Change timeout to TIM tenths of seconds. This is ignored if timeout handling is turned of through the O option.
- -U, --unrestrict
- Removed. Security-relevant options cannot be turned off; see SECURITY and the HISTORICAL NOTES section. Use --keep-incomplete if you want failed transfers to leave the partial file in place.
- --version
- prints out version number.
- -v, --verbose
- Verbose output to stderr. With one v, a summary (file names, transfer result, error events) is printed. With two vs, progress reports are also shown. More vs are accepted but have no effect. Since version 0.13 detailed protocol debugging is available with --debug instead.
- --debug=MODULES
- Enable debug output for the comma separated list of MODULES on stderr. Known modules: "protocol" (ZMODEM frame state machine), "readline" (line reader: select/read calls, timeouts, hex dump), "transfer" (file transfer state machine), "windowhandling" (adaptive block length and window logic, ZMODEM sender only), "tty" (terminal mode changes). The special name "all" enables all.
- -wN, --windowsize N
- Set window size to N.
- -X, --xmodem
- use XMODEM protocol.
- -y, --overwrite
- Yes, clobber any existing files with the same name. (Ignored in XMODEM mode, where lrz always writes to the given pathname.)
- --ymodem
- use YMODEM protocol.
- -Z, --zmodem
- use ZMODEM protocol.
SECURITY¶
Contrary to the original ZMODEM lrz defaults to restricted mode. Security-relevant options can be enabled but never disabled: restricted mode cannot be turned off, and the very restricted mode cannot be downgraded.
Remote command execution is always denied, in every mode.
lrz has two restricted levels:
- restricted (the default)
- lrz will not accept absolute pathnames or references to a parent directory, will not modify an existing file, and removes any files received in error (see --keep-incomplete for an exception).
- very restricted
- Additionally disables creation of subdirectories and files with a leading dot, and refuses to overwrite existing files instead of skipping them. Entered by setting the environment variable ZMODEM_RESTRICTED or giving the R option — in either case, and regardless of the order in which options are given.
ENVIRONMENT¶
lrz uses the following environment variables:
- SHELL
- lrz recognizes a restricted shell if this variable includes rsh or rksh
- ZMODEM_RESTRICTED
- lrz enters the very restricted mode if the variable is set. Giving the R option also enables the very restricted mode.
NOTES¶
Sending serial data to timesharing minicomputers at sustained high speeds has been known to cause lockups, system halts, kernel panics, and occasional antisocial behaviour. When experimenting with high speed input to a system, consider rebooting the system if the file transfers are not successful, especially if the personality of the system appears altered.
The Unix "ulimit" parameter must be set high enough to permit large file transfers.
The TTY input buffering on some systems may not allow long blocks or streaming input at high speed. You should suspect this problem when you can't send data to the Unix system at high speeds using ZMODEM, YMODEM-1k or XMODEM-1k, when YMODEM with 128 byte blocks works properly. If the system's tty line handling is really broken, the serial port or the entire system may not survive the onslaught of long bursts of high speed data.
32 bit CRC code courtesy Gary S. Brown. Directory creation code from John Gilmore's PD TAR program.
BUGS¶
Programs that do not properly implement the specified file transfer protocol may cause lrz to "hang" the port for a minute or two. Every reported instance of this problem has been corrected by using a program with a correct implementation of the specified protocol.
Many programs claiming to support YMODEM only support XMODEM with 1k blocks, and they often don't get that quite right.
Pathnames are restricted to 127 characters. In XMODEM single file mode, the pathname given on the command line is still processed as described above. The file management options (-+, -E, -H, -n, -N, -p, -y) are ZMODEM features (with partial YMODEM support); they are ignored in XMODEM mode. XMODEM always writes to the pathname given on the command line - the restricted mode checks still apply.
The ASCII option´s CR/LF to NL translation merely deletes CR´s.
ZMODEM CAPABILITIES¶
Rz supports incoming ZMODEM binary (-b), ASCII (-a), protect (-p), clobber (-y), and append (-+) requests. The default is protect (-p) and binary (-b).
The Unix versions support ZMODEM command execution.
CAVEATS¶
The ZMODEM protocol uses 32-bit fields for file positions, imposing a hard limit of 4 GiB on transfer size. Furthermore, many ZMODEM implementations derived from the original Omen Technology codebase (including crzsz, rzsz, lrzszolderthanversion0.13, and other 1990s variants) and also at least some independent implementation use signed long internally, which on 32-bit platforms limits correct operation to files below 2 GiB. lrz itself handles positions up to 4 GiB correctly, but interoperation with older or 32-bit senders may fail for files larger than 2 GiB.
HISTORICAL NOTES¶
The following options have been removed and are no longer functional. Using them prints an error message and exits.
- -C, --allow-commands
- Allowed remote command execution via ZMODEM. Removed because of weak security: it relied on the parent process to only set this option when the remote user is perfectly trustworthy.
- -S, --timesync
- Time synchronization. Removed because no other still-available implementation supported it, and setting the local time would have required root privileges.
- -U, --unrestrict
- Turned off restricted mode (impossible under a restricted shell). Removed because security-relevant options cannot be turned off: whoever can pass -U can equally well drop it from the command line, so the option provided no protection — only a trap. The one legitimate use, keeping partially received files on error, lives on as the --keep-incomplete option. See SECURITY.
- PUBDIR
- The PUBDIR environment variable and the associated public directory feature (restricting file transfers to PUBDIR, usually /var/spool/uucppublic) have been removed.
- -B auto
- The auto argument to -B / --bufsize (formerly buffering the entire file in memory) has been removed. No performance benefit was observed on modern systems.
| OMEN |