OpenWindows Advanced User's Guide

9.2 Logging In Remotely (rlogin)

The rlogin command allows you to log in to other UNIX machines on your network.

To remotely log in to another machine, type:

$ rlogin machinename

where machinename is the name of the remote machine.

If a password prompt appears, type the password for the remote machine and press Return. If your machine name is in the other machine's /etc/hosts.equiv file, the other machine "trusts" your machine name and won't require you to type the password.

$ rlogin lonesome
Password: (type password)
Last login: Mon Jan 6 09:37:55 from blue
Sun Microsystems, Inc.   SunOS 5.1      October 1992
(The following commands done on lonesome.)
$ pwd
/home/keithp
$ logout
Connection closed.
$

9.2.1 rlogin without a Home Directory

In the example above, user keithp logged in to lonesome at the directory /home/keithp, as indicated by the pwd command. When you log in to a machine where you don't have a home directory, rlogin displays a message stating that you have no home directory on the remote machine and logs you in to the root (/) directory of that machine:

$ rlogin fretful
Password:
No directory! Logging in with home=/
Last login: Fri Jan 3 10:21:59 from blue
Sun Microsystems, Inc.    SunOS 5.1      October 1992
(The following commands done on fretful.)
$ pwd
/
$ logout
Connection closed.
$

9.2.2 rlogin as Someone Else

There may be times when you want to log in to a remote machine as someone else. For example, if you're working on someone else's machine (using their username) and you want to log in to your own machine as yourself. The -l option to rlogin allows you to do this. The command syntax is:

rlogin machinename -l username

For example, the following shows how user keithp on machine blue would log in to machine lonesome as earl:

$ rlogin lonesome -l earl
Password:
Last login: Wed Jan 8 07:12:25 from blue
Sun Microsystems, Inc.    SunOS 5.1      October 1992
(The following commands done on lonesome.)
$ pwd
/home/earl
$ logout
Connection closed.
$

Note that when you log in to a remote machine as someone else, you are placed in that user's home directory.

9.2.3 rlogin to an Unknown Machine

If you try to log in to a remote machine whose name isn't known to your machine, rlogin searches unsuccessfully through the hosts database and then displays a notification as follows:

$ rlogin stranger
stranger: unknown host
$

9.2.4 Aborting an rlogin Connection

Normally you terminate an rlogin connection by typing logout at the end of a work session. If for some reason you can't terminate a session in this manner, you can abort the connection by typing a tilde character followed by a period (~.) at the beginning of a line. The login connection to the remote machine is aborted and you are placed back at your original machine.

If you log in to a series of machines, gaining access to each machine through another machine, and you use ~. to abort the connection to any of the machines in the series, you are returned to your original machine:

$ rlogin dakota
Password:
Last login: Fri Jan 10 09:14:43 from blue
Sun Microsystems, Inc.    SunOS 5.1      October 1992
(The following command done on dakota.)
$ ~.  (You may not see the ~ on the screen.)
Connection closed.
$

If you want to back up to an intermediate rlogin connection, use two tildes followed by a period (~~.) as follows:

$ rlogin lonesome
Password:
Last login: Tue Jan 7 08:12:49 from blue
Sun Microsystems, Inc.    SunOS 5.1      October 1992
(The following command done on lonesome.)
$ rlogin dakota
Password:
Last login: Tue Jan 7 10:17:40 from lonesome
Sun Microsystems, Inc.    SunOS 5.1      October 1992
(The following command done on dakota.)
$ ~~.  (You may not see the ~~ on the screen.)
Connection closed.
$

9.2.5 Suspending an rlogin Connection

When you want to suspend an rlogin connection so you can return to it later, type the tilde character (~) followed by Ctrl-Z. The rlogin connection becomes a stopped process and you are placed back at the machine from which you logged in.

To reactivate the connection, type fg. Alternatively, you can type the percentage sign (%) followed by the process number of the stopped process (the default for %, if no process number is included, is the process most recently suspended).

$ rlogin lonesome
Password:
Last login: Tue Jan 7 08:12:49 from blue
Sun Microsystems, Inc.    SunOS 5.1      October 1992
(The following command done on lonesome.)
 ~^Z  (You may not see the ^Z on the screen.)
Stopped
(The following command done on blue.)
$ pwd
/home/keithp
$ %
rlogin lonesome

(The following command done on lonesome.)
$ logout
Connection closed.
$

Similar to aborting rlogin with ~~., typing two tildes and Ctrl-Z suspends the current rlogin and places you at an intermediate rlogin.

9.2.6 Verifying Your Location (who am i)

After logging in to a variety of remote machines, perhaps under different login names, you might need to verify exactly where you are. Typing who am i displays the name of the machine you're currently logged into as well as your current identity.

Type man rlogin at the command prompt or refer to the man Pages(1): User Commands.