[Return to Library] [Contents] [Previous Chapter] [Next Section] [Next Chapter] [Index] [Help]


13    Working on a Remote Host

The chapter explains how to use commands which enable you to:

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.


[Return to Library] [Contents] [Previous Chapter] [Next Section] [Next Chapter] [Index] [Help]


13.1    Using rlogin to Log in to a Remote Host

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:

  1. Enter the following rlogin command followed by the name of the remote host. For example:

    rlogin boston

    Password:
    

  2. Enter your password.

    When the system prompt is displayed, you are logged in to the remote host and can enter any command.

  3. To close the connection and return to your local host, press Ctrl/d.

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.

  1. Enter the rlogin -l command followed by the remote login name and the name of the remote host. For example:

    rlogin -l celtic boston

    Password:
    

  2. Enter the password corresponding to the login name, celtic.

    When the system prompt is displayed, you are logged in to the remote host and can enter any command.

  3. To close the connection and return to your local host, press Ctrl/d.

In the following situations, rlogin will not prompt for a password:

For more information on rlogin, see the rlogin(1) reference page.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


13.2    Using rsh to Run Commands on a Remote Host

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, rsh prompts you for login information to the remote host.

To use rsh, one of the following must be true:

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


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Chapter] [Index] [Help]


13.3    Using telnet to Log Into a Remote Host

You can log into a remote host by using the telnet command, which implements the Telnet protocol.

Using telnet you can:

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:

  1. Enter the 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:
    

  2. Enter your login name; enter your password.

  3. Press Ctrl/] (the default escape sequence) to access the telnet subcommand prompt, telnet>.

  4. Enter the 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 '^]'.
    

  5. To use another subcommmand, press Ctrl/] to redisplay the telnet> prompt. To display the remote host prompt, press the Return key.

  6. To quit the Telnet session from the host prompt, press Ctrl/d.

    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.

Table 13-1: telnet Subcommands

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.