## An Overview
## Greg Munker <>
The first of the commands examined here falls into the set called the
r-commands. These are the rlogin, rcp, and rsh/rcmd commands. They
are called the r-commands because they all start with the letter "r".
The successful use of these commands in this article is dependent upon
the user and host equiv being properly configured. Most users have
difficulty with these commands because their network admin has not
properly configured the host and user equiv.
rlogin
The rlogin command connects you local session to a remote session on
a different host. To initiate a remote terminal session, use the
following command:
[Syntax]
rlogin [-8DEKLdx] [-e char] [-k realm] [-l username] host
For example:
[2]<[email protected]># rlogin telnet.submental.org
Last login: Tue Feb 16 00:54:53 from 207.202.64.115
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD 2.2.7-RELEASE (SubMental) #0: Wed Jul 22 08:48:29 GMT 1998
[3]<[email protected]>#
The terminal type of the remote connection is the same as the
terminal type that is in use for the current connection, unless
modified by the user's startup files. All of the character echoing is
done done at the remote site, so except for delays, the use of rlogin
is transparent to the user. Termination of the connection is made
either by logging out of the remote host, or through the termination
character, which is ~. (tilde period).
rcp
The rcp or "Remote Copy" command enables the user to copy a file from
one host to another. Each file or directory argument is either a
remote filename of the form 'rhost:path', or a local filename
(containing no `:` characters, or a `/` before any `:`).
[Syntax]
rcp [ -p ] file1 file2
rcp [ -p ] [ -r ] file ..... directory
The following is an example of copying a file from the local host to
the remote system:
[2]<[email protected]># rcp test.new infected:test.new
[2]<[email protected]>#
When the filename, as shown in the example, does not begin with a
(/), the file is copied in a directory relative to your home directory
on the remote system. The rcp command behaves like like the cp command
in that the file could be called by a different name on the remote
system.
If the -r option is specified and any of the source files are
directories, rcp copies each subtree rooted at that name; in this
case, the destination must be a directory. By default, the mode and
owner of file2 are preserved if the file already existed; otherwise,
the mode of the source file modified by the umask on the destination
host is used.
The -p option causes `rcp` to attempt to preserve (duplicate) in it
copies the modification times and modes of the source file, ignoring
the umask.
rsh
rsh is to execute a command on a remote system. Interactive commands
are not good candidates for this type of execution.
Typically, the system that use rsh for remote execution are BSD-based
Unix systems. rsh works by connecting to the specified hostname and
executing the specified remote command to its standard output, and
the standard error of the remote command to its standard error.
Interrupt, quit, and terminate signals are propagated to the remote
commands; rsh is normally terminated when the remote command does.
[Syntax]
rsh [-Kdnx] [-t timeout] [-k realm] [-l username] host [command]
The execution of a command involves entering the name of the host
where the command is to be executed and the name of the command.
Running rsh with no command argument has the effect of logging you
into the remote system by using rlogin. The following examples
illustrate using rsh to execute commands:
[2]<[email protected]># rsh infected date
Tue Feb 23 21:37:54 GMT 1999
[2]<[email protected]># rsh infected hostname
infected.org
[2]<[email protected]>#
There are only two options to rsh:
-l username
Use username as the remote username instead of your local username. In the
absence of this option, the remote username is the same as your local username.
-n
Redirect the input of rsh to /dev/null. You sometimes need this option to
avoid unfortunate interactions between rsh and the shell that invokes it.
If, for example, you are running rsh and start an rsh in the background
without redirecting its input away from the terminal, it will block even
if no reads are posted by the remote command. Using the -n option prevents
this.
Virtually any command can be executed on the remote system. Commands
that rely upon terminal characteristics or a level of user interaction,
however, are not good candidates for the use of rsh.
Hopefully this explained the r* commands well enough for you to make
use of them. For more information, please read the appropriate man
pages.
Greg Munker
Return to Issue #3
|