RMT(1)
π RMT(1) β remote magnetic tape protocol server π
okay bestie, this is the SchilyΒ΄s USER COMMANDS page for RMT(1), and weβre about to make remote tape access make sense. π
πΈ NAME πΈ
rmt β remote magnetic tape protocol server β¨
β¨ SYNOPSIS β¨
/usr/bin/rmt
π DESCRIPTION π
This is the description of the enhanced Schily version of the rmt remote tape server program. rmt is a program used by programs like star and ufsdump that like to access remote magnetic tape drives and files through an interprocess communication connection. rmt is normally started up with an rexec(3) or rcmd(3) call.
The rmt program accepts open, close, read, write and seek requests as well as requests that are specific to magnetic tapes. rmt performs the commands and then responds with a status indication. π«Ά
This version of the rmt server gives full compatibility to the original BSD version, the enhanced Sun version and the enhanced GNU version. In addition to the Sun and GNU enhancements, it implements further abstractions for better cross platform compliance. It supports best speed and best compliance even when server and client code are running on different platforms. It is prepared to be installed as a user shell in the passwd file to create remote tape specific logins and security checking. To use the enhanced compatibility features, you need to either use the remote tape client code from star which is available in librmt or reimplement its features.
All responses are sent back in ASCII. They are in one of the following two forms. π
Successful commands have responses of
Anumber\n
where number is the ASCII representation of a decimal number that usually is the return code of the corresponding system call.
Unsuccessful commands are responded to with
Eerror-number\nerror-message\n
where error-number is one of the possible error numbers described in intro(2), and error-message is the corresponding error string as retrieved by strerror(3). Note that the error number is valid on the remote system where the rmt code runs and may have a different meaning on the local system. iykyk π
π Protocol commands, no skips π
The protocol implements the following commands:
Odevice\nmode\nβ open the specified device or file using the indicated mode. device is a full path name, and mode is an ASCII representation of a decimal number suitable for being passed as second parameter toopen(2).Odevice\nmode symbolic_mode\nβ the variant of the open command that includes the symbolic_mode string, which is a GNU extension. β¨
If both mode and symbolic_mode are present, they are separated by a space character; symbolic_mode appears on the same line as the numeric mode. It is sent using the same notation as used in a C source (e.g. O_RDWR|O_CREAT). If the symbolic_mode is sent to the server, the numeric mode is ignored. The symbolic notation allows one to send the expected open mode over the wire, using a system independent method. This is needed because different operating systems usually define all bits in a different way. An exception are the lowest two bits. The lowest two bits allow one to code O_RDONLY, O_WRONLY and O_RDWR. To prevent unexpected behavior, rmt masks the numeric open mode with 0x03 before using it as argument to the open(2) call. If you need more bits in the second parameter to open(2), you need to use the symbolic mode. π
If no file /etc/default/rmt exists, only filenames starting with /dev/ are accepted for security reasons. π¨
If a device is already open, it is closed before a new open is performed.
A RMT protocol VERSION 1 client should issue a
I-1\n0\n
command just after opening a file or device. This is needed to tell the server that the client is aware of the official order of the mt_op codes in the range 0..7 and that it maps deviating values to the official ones.
Cdevice\nβ close the currently open device or file. The argument device is ignored.Rcount\nβ read count bytes of data from the open device or file.rmtperforms the requestedread(2)operation and responds withAcount-read\nif the read operation was successful; otherwise an error in standard format is returned. If the read operation was successful, the data read is sent directly after the response described above. πWcount\nβ write data to the open device or file. After reading the command specification,rmtreads count bytes from the network connection and aborts if a premature EOF is encountered. The return value from thewrite(2)operation is returned as reply.Lwhence\noffset\nβ perform anlseek(2)operation on the open device or file using the specified parameters. The return value from thelseek(2)operation is returned as reply.
On large file aware operating systems, rmt will correctly handle large lseek(2) requests.
The following whence values are supported:
0β mapped toSEEK_SET.1β mapped toSEEK_CUR.2β mapped toSEEK_END.3β mapped toSEEK_DATAIf available on the remote system.4β mapped toSEEK_HOLEIf available on the remote system.
Sβ the old non-portable status call. This call should not be used anymore, it has been replaced by the new RMT protocol version 1 extended status call below. If the currently open device is a magnetic tape, return the magnetic tape status, as obtained with aMTIOCGETioctl call. If the open device is not a magnetic tape, an error is returned. If theMTIOCGEToperation was successful, an βackβ is sent with the size of the status buffer, then the status buffer is sent. As the status buffer is sent in binary, this command is considered outdated. Please use the extended status command instead. This command is not terminated by a new-line. β οΈssub-commandβ the new portable status call. This command is part of the RMT protocol version 1. If the currently open device is a magnetic tape, return a single specified member of the magnetic tape status structure, as obtained with aMTIOCGETioctl call. If the open device is not a magnetic tape, an error is returned. If theMTIOCGEToperation was successful, the numerical value of the structure member is returned in decimal. The following sub commands are supported:Tβ return the content of the structure membermt_typewhich contains the type of the magnetic tape device.Dβ return the content of the structure membermt_dsregwhich contains the βdrive status registerβ.Eβ return the content of the structure membermt_erregwhich contains the βerror registerβ.
This structure member must be retrieved first because it is cleared after each MTIOCGET ioctl call. The librmt will always retrieve the member mt_erreg first when it is told to retrieve a complete status structure. π
Rβ return the content of the structure membermt_residwhich contains the residual count of the last I/O.Fβ return the content of the structure membermt_filenowhich contains the block number of the current tape position.Bβ return the content of the structure membermt_blknowhich contains the block number of the current tape position.fβ return the content of the structure membermt_flagswhich containsMTF_flags from the driver.bβ return the content of the structure membermt_bfwhich contains the optimum blocking factor.
This command is not terminated with a new-line.
okay next up in the command menu β keep your hands off the tape unless you mean it π
Ioperation\ncount\nβ do aMTIOCOPioctl(2)command with the parameters you pass. The parameters are read as ASCII representations of the decimal values that go into themt_opandmt_countfields of the structure used in theioctlcall. If it works, the return value is thecountparameter. Only opcodes0..7are unique across different architectures. In many cases Linux does not even follow this rule, and that could harm tape media if an old non RMT protocol VERSION 1 aware rmt client connects from UNIX to Linux or from Linux to UNIX. If we know we've been called by a RMT protocol VERSION 1 client, we may safely assume that client is not using the Linux mapping over the wire but the standard mapping described below:-1β retrieve the version number of the rmt server and tell the server that the client is aware of the official order of theMTIOCOPioctl(2)opcodes in the range0..7. Localmt_opcodes must be remapped to the official values before sending them over the wire. The answer of the current version of rmt is1. Old rmt implementations send an error code back when this command is used. Future rmt implementations with further enhancements will send an answer with a value> 1.0β issue aMTWEOFcommand (writecountend-of-file records).1β issue aMTFSFcommand (forward space overcountfile marks).2β issue aMTBSFcommand (backward space overcountfile marks).3β issue aMTFSRcommand (forward spacecountinter-record gaps).4β issue aMTBSRcommand (backward spacecountinter-record gaps).5β issue aMTREWcommand (rewind).6β issue aMTOFFLcommand (rewind and put the drive off-line).7β issue aMTNOPcommand (no operation, set status only).
ioperation\ncount\nβ do aMTIOCOPioctl(2)command with the specified parameters. This command is a RMT protocol VERSION 1 extension and implements support for commands beyondMTWEOF..MTNOP(0..7). The parameters are read as ASCII representations of the decimal values described below. They get converted into the local values of themt_opandmt_countfields of the structure used in theioctlcall according to the actual values found in<sys/mtio.h>. If it works, the return value is thecountparameter.0β issue aMTCACHEcommand (switch cache on).1β issue aMTNOCACHEcommand (switch cache off).2β issue aMTRETENcommand (retension the tape).3β issue aMTERASEcommand (erase the entire tape).4β issue aMTEOMcommand (position to end of media).5β issue aMTNBSFcommand (backward spacecountfiles to BOF).
v\nβ return the version of the rmt server. Right now that's the decimal number1.
Any other command causes rmt to exit. like, it's done, bye π
π FILES
/etc/default/rmt β bestie, this file lets you set up rules to limit the accessibility of files based on rules. This feature is typically used when rmt is run from a non personal but task specific login.
Default values can be set for the following options in /etc/default/rmt. For example:
DEBUG=/tmp/rmt.debug
USER=tape
ACCESS=tape myhost.mydomain.org /dev/rmt/*
All keywords must be on the beginning of a line.
DEBUGβ if you like to get debug information, set this to a file name where rmt should put debug information.USERβ the name of a user (local to the magnetic tape server) that may use the services of the rmt server. More than oneUSER=nameline is possible. A lineUSER=*grants access to all users.ACCESSβ this keyword is followed by three parameters separated by a Tab. The name of a user (local to the magnetic tape server host) that may use the services of the rmt server, followed by the name of a host from where operation is granted, and a file specifier pattern for a file or file sub tree that may be accessed if thisACCESSline matches. More than oneACCESS=name host pathline is possible.
If standard input of rmt is not a socket from a remote host, rmt will compare the host entry from /etc/default/rmt with the following strings:
PIPEβ if stdin is a UNIX pipe.
If you like to allow remote connections that use the ssh protocol, you need to use the word PIPE instead of the real hostname in the matching ACCESS= line.
ILLEGAL_SOCKETβ ifgetpeername()does not work for stdin.NOT_IPβ ifgetpeername()works for stdin but is not connected to an internet socket.
π SEE ALSO
star(1), ufsdump(1), ufsrestore(1), intro(2), open(2), close(2), read(2), write(2), ioctl(2), lseek(2), getpeername(3), rcmd(3), rexec(3), strerror(3), mtio(7), rmtopen(3), rmtclose(3), rmtread(3), rmtwrite(3), rmtseek(3), rmtioctl(3), rmtstatus(3)
π©Ί DIAGNOSTICS
All responses are sent to the network connection. They use the form described above.
π NOTES
To use rmt as a remote file access protocol you need to use the symbolic open modes, as e.g. the O_CREAT flag is not unique between different architectures.
In order to allow this implementation to be used as a remote file access protocol, it accepts file names up to 4096 bytes with the open command. Other rmt implementations allow no more than 64 bytes.
The possibility to create a debug file by calling rmt file has been disabled for security reasons. If you like to debug rmt, edit /etc/default/rmt and insert a DEBUG entry.
This implementation of rmt adds some security features to the server that make it behave slightly different from older implementations. Read the above documentation about the file /etc/default/rmt to make sure your local installation is configured for your needs.
To grant the same permissions as with old rmt servers, create a file /etc/default/rmt and add the following lines to this file:
USER=*
ACCESS=* * *
Note that the three fields in the ACCESS= line need to be separated by a Tab character.
β οΈ Be very careful when designing patterns to match path names that may be accepted for open. If a pattern would allow inclusion of/../in the path, a possible intruder could virtually access any path on your system. For this reason,/../is not allowed to appear in a path regardless of the pattern.
π BUGS
None currently known.
Mail bugs and suggestions to schilytools@mlists.in-berlin.de or open a ticket at https://codeberg.org/schilytools/schilytools/issues.
The mailing list archive may be found at:
https://mlists.in-berlin.de/mailman/listinfo/schilytools-mlists.in-berlin.de.
π°οΈ HISTORY
The rmt command first appeared on BSD in march 1981. This rmt server is a new implementation that tries to be compatible to all existing implementations. It is the only known implementation that in addition tries to fix the data exchange problems between different architectures.
This rmt implementation has been written in 1994 by Joerg Schilling. In 2000, support for RMT VERSION 1 has been added and a mapping to work around the non-standard Linux mtio opcodes in the range 0..7 has been added. rmt is now maintained by the schilytools project authors.
βοΈ AUTHORS
Joerg Schilling and the schilytools project authors.
β¬οΈ SOURCE DOWNLOAD
The source code for rmt is included in the schilytools project and may be retrieved from the schilytools project at Codeberg at
https://codeberg.org/schilytools/schilytools.
The download directory is
https://codeberg.org/schilytools/schilytools/releases.
okay that's the whole RMT(1) page, bestie β source/version RMT(1), date 2022/09/09, by Joerg Schilling. go be iconic and tape responsibly πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: schily-rmt 2022.10.16-160000.2.2 Β· CDDL-1.0
- opensuse-leap 16.0: schily-rmt 2022.10.16-160000.2.2 Β· CDDL-1.0
- opensuse-leap 16.0: schily-rmt 2022.10.16-160000.2.2 Β· CDDL-1.0
- opensuse-leap 16.0: schily-rmt 2022.10.16-160000.2.2 Β· CDDL-1.0
- Copyright 1994-2020 J. Schilling
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms