Blob Blame History Raw
.\" This file is part of GNU tar. -*- nroff -*-
.\" Copyright 2013 Free Software Foundation, Inc.
.\"
.\" GNU tar is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" GNU tar is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
.TH RMT 1 "January 27, 2014" "RMT" "GNU TAR Manual"
.SH NAME
rmt \- remote magnetic tape server
.SH SYNOPSIS
.B rmt
.SH DESCRIPTION
.B Rmt
provides remote access to files and devices for
.BR tar (1),
.BR cpio (1),
and similar backup utilities.  It is normally called by running
.BR rsh (1)
or
.BR ssh (1)
to the remote machine, optionally using a different
login name if one is supplied.
.PP
The calling program communicates with
.B rmt
by sending requests on its standard input and reading replies from the
standard output.  A request consists of a request letter followed by
an argument (if required) and a newline character.  Additional data,
if any, are sent after the newline.  On success,
.B rmt
returns
.PP
.in +4
.BI A number \en
.PP
where \fInumber\fR is an ASCII representation of a decimal return
code.  Additional data are returned after this line.  On error, the
following response is returned:
.PP
.in +4
.BI E errno \en error-message \en
.PP
where \fIerrno\fR is one of the system error codes, as described in
.BR errno (3),
and \fIerror-message\fR is a one-line human-readable description of
the error, as printed by
.BR perror (3).
.PP
Available commands and possible responses are discussed in detail in
the subsequent section.
.SH COMMANDS
.TP
.BI O device \en flags \en
Opens the \fIdevice\fR with given \fIflags\fR. If a
device had already been opened, it is closed before opening the new one.
.sp
.B Arguments
.RS
.TP
.I device
The name of the device to open.
.TP
.I flags
Flags for
.BR open (2):
a decimal number, or any valid \fBO_*\fR constant from
.B fcntl.h
(the initial \fBO_\fR may be omitted), or a bitwise or (using \fB|\fR)
of any number of these, e.g.:
.in +4
.EX
576
64|512
CREAT|TRUNC
.EE
.RS
In addition, a combined form is also allowed, i.e. a decimal mode followed
by its symbolic representation.  In this case the symbolic representation
is given preference.
.RE
.sp
.B Reply
.RS
.B A0\en
on success.
.RE
.sp
.B Extensions
.RS
BSD version allows only decimal number as \fIflags\fR.
.RE 1
.TP
\fBC\fR[\fIdevice\fR]\fB\en\fR
Close the currently open device.
.RS
.TP
.B Arguments
.br
Any arguments are silently ignored.
.TP
.B Reply
.br
.B A0\en
on success.
.RE
.TP
.BI L whence \en offset \en
.RS
Performs an
.BR lseek (2)
on the currently open device with the specified
parameters.
.TP
.B Arguments
.RS
.TP
.I whence
Where to measure offset from. Valid values are:
.sp
.nf
.ta 1n 20n
	0, SET, SEEK_SET	seek from the file beginning
	1, CUR, SEEK_CUR	seek from the current location
	2, END, SEEK_END	seek from the file end
.fi
.RE
.TP
.B Reply
.br
.BI A offset \en
on success. The \fIoffset\fR is the new offset in file.
.TP
.B Extensions
BSD version allows only 0,1,2 as \fIwhence\fR.
.RE
.TP
.BI R count \en
.br
Read \fIcount\fR bytes of data from the current device.
.RS
.TP
.B Arguments
.RS
.TP
.I count
number of bytes to read.
.RE
.TP
.B Reply
.br
On success:
.sp
.in +4
.BI A rdcount \en
.in
.sp
followed by \fIrdcount\fR bytes of data read from the device.
.RE
.TP
.BI W count \en
Writes data onto the current device.  The command is followed by
\fIcount\fR bytes of input data.
.RS
.TP
.B Arguments
.RS
.TP
.I count
Number of bytes to write.
.RE
.TP
.B Reply
.br
On success: \fBA\fIwrcount\fB\en\fR, where \fIwrcount\fR is the number of
bytes actually written.
.RE
.TP
.BI I opcode \en count \en
Perform a
.B MTIOCOP
.BR ioctl (2)
command with the specified paramedters.
.RS
.TP
.B Arguments
.RS
.TP
.I opcode
.B MTIOCOP
operation code.
.TP
.I count
mt_count.
.RE
.TP
.B Reply
.br
On success: \fBA0\en\fR.
.RE
.TP
.B S\en
Returns the status of the currently open device, as obtained from a
.B MTIOCGET
.BR ioctl (2)
call.
.RS
.TP
.B Arguments
.br
None
.TP
.B Reply
.br
On success: \fBA\fIcount\fB\en\fR followed by \fIcount\fR bytes of
data.
.RE
.SH "SEE ALSO"
.BR tar (1).
.SH BUGS
Using this utility as a general-purpose remote file access tool is
discouraged.
.SH "BUG REPORTS"
Report bugs to <bug\-tar@gnu.org>.
.SH HISTORY
The
.B rmt
command appeared in 4.2BSD.  The GNU
.BR rmt
is written from scratch, using the BSD specification.
.SH COPYRIGHT
Copyright \(co 2013 Free Software Foundation, Inc.
.br
.na
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
.br
.ad
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.\" Local variables:
.\" eval: (add-hook 'write-file-hooks 'time-stamp)
.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.\\-]* [0-9] \""
.\" time-stamp-format: "%:B %:d, %:y"
.\" time-stamp-end: "\""
.\" time-stamp-line-limit: 20
.\" end: