The chapter explains how to use commands which enable you to:
rlogin
is not supported, use
telnet
as an alternative.
Note
Any remote login is subject to the security features on the remote host. If you have difficulty logging in to a remote host, see your system administrator.
Before using any of these commands you might need to know the correct
host name or whether a remote host is currently reachable. Use the
finger,
who,
rwho,
ruptime,
and
ping
commands, described in
Chapter 10
to find this information.
You can log in to a remote host with
rlogin,
using the following command syntax:
rlogin
[
-l
user
]
host_name
The
-l
option enables you to specify a remote username other than
your local username. The
host_name
variable specifies the remote host.
The following steps show how to log in to a remote host
boston
where the login name is the same as that on the local host:
rlogin
command followed by the name of the remote host. For example:
%
rlogin boston
Password:
When the system prompt is displayed, you are logged in to the remote host and can enter any command.
If you have an account on a remote host where your login name is different
from that on the local host, you must use the
-l
option to log in to the remote host, as
shown in the following steps.
rlogin -l
command followed by the remote login name and the name of the remote
host. For example:
%
rlogin -l celtic boston
Password:
celtic.
When the system prompt is displayed, you are logged in to the remote host and can enter any command.
In the following situations,
rlogin
will not prompt for a password:
/etc/hosts.equiv
file on the remote host
.rhosts
file in your home directory on the remote host
For more information on
rlogin,
see the
rlogin(1)
reference page.
The
rsh
command enables you to run a single command on a remote UNIX based
host without logging in there. If you need to run several commands
successively, you must log in to the remote host using either
rlogin
or
telnet.
The
rsh
command has the following syntax:
rsh
[
-l
user
]
host_name command
The
-l
option enables you to log in to a remote host where your login name,
user,
is different from that on the local host. If you do not specify the
-l
option,
rsh
assumes that your login name is the same on both the local and remote
hosts. The
host_name
variable specifies the name of the remote host. The
command
variable specifies the command you want to run.
Note
If you do not specify a command to run remotely,
rshprompts you for login information to the remote host.
To use
rsh,
one of the following must be true:
/etc/hosts.equiv
file on the remote host.
.rhosts
file in your home directory on the remote host.
In the following example,
rsh
appends a file located on a remote host to a file on the
local host. The remote file,
remfile2,
on host
remhost2
is appended to a local file called
locfile:
%
rsh remhost2 cat remfile2 >> locfile
You can log into a remote host by using the
telnet
command, which implements the Telnet protocol.
Using
telnet
you can:
telnet
subcommands (see
Table 13-1)
for managing the remote session
The
telnet
command has the following syntax:
telnet
[
host_name
[
port
]
]
The
host_name
variable specifies the remote host.
If you omit the host name,
you can use the
open
subcommand to create a connection
after you activate the Telnet utility.
If you do not specify a
port,
the Telnet
protocol attempts to contact a Telnet server at the default port.
The following steps show how to use the
telnet
command to log in to a remote host named
host3,
and to use the
telnet
subcommand
status:
telnet
command and specify the
host_name
as
host3
(the default port is used):
%
telnet host3
Trying... Connected to host3 Escape character is '^]'. host3 TCLPTelnet service. login:
telnet
subcommand prompt,
telnet>.
status
subcommand at the prompt, to display status information similar to the
following:
telnet>
status
Connected to host3. Operating in character-at-a-time mode. Escape character is '^]'.
telnet>
prompt. To display the remote host prompt, press the Return key.
To quit the Telnet
session from the
telnet>
subcommand prompt, enter
q,
or press Ctrl/d.
You can enter the
telnet
command without any arguments to access the
telnet
subcommand mode, indicated by the
telnet>
prompt.
The
telnet
subcommands are described in
Table 13-1.
Before entering a subcommand, you must enter the escape sequence,
Ctrl/]. This sequence notifies the
telnet
program that the following information is not text; otherwise,
telnet
would interpret subcommands as text.
For each subcommand, you only need to type
enough letters to uniquely identify the command. For example,
q
is sufficient for the
quit
command. For a complete list of
telnet
subcommands, see the
telnet(1)
reference page.
| Subcommand | Description |
? [subcommand]
|
Displays help information. If a subcommand is specified, information about that subcommand is displayed. |
close
|
Closes the connection and returns to
telnet
command mode.
|
display [argument]
|
Displays all of the set and toggle values if no argument is specified; otherwise, lists only those values that match argument. |
open host [port]
|
Opens a connection to the specified host. The
host specification can be either a host name or an Internet address
in dotted decimal form. If no port is given,
telnet
attempts to contact a
telnet
server at the default port.
|
quit
|
Closes a connection and exits the
telnet
program. Pressing a Ctrl/d in command mode also
closes the connection and exits.
|
status
|
Shows the status of
telnet,
including the current mode
and the currently connected remote host.
|
z
|
Opens a shell on the local host as
specified by the SHELL environment variable. When you
exit the shell by pressing Ctrl/d,
telnet
returns to the remote session.
|