Solaris Advanced User's Guide

Logging In Remotely (rlogin)

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

To remotely log in to another machine, type the following command.


$ rlogin  machinename

In the previous example, 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 current machine does not prompt you to type the password.


venus$ rlogin starbug -l user2
Password: 
Last login: Wed Nov  1 13:08:36 from venus
Sun Microsystems Inc.   SunOS 5.9       Generic February 2002
venus$ pwd
/home/user2
venus$ logout
Connection closed.
venus$

rlogin Without a Home Directory

In the previous example, user user2 logs in to the remote machine starbug at the directory /home/user2, as indicated by the pwd command. When you log in to a machine where you have no account, rlogin displays a message stating that you have no home directory on the remote machine. rlogin then logs you in to the root (/) directory of that machine:


venus$ earth -l user2
Password:
No directory! Logging in with home=/
Last login: Thu Nov  2 12:51:57 from venus
Sun Microsystems Inc.   SunOS 5.9       Generic February 2002
earth$ pwd
/
earth$ logout
Connection closed.
earth$

rlogin as Someone Else

The -l option of the rlogin command enables to log in to a remote machine as someone else. This option can be useful if you are working on someone else's machine (using their username) and you want to log in to your own machine as yourself.

Use the following command syntax for the -l option of the rlogin command.


# rloginmachinename -l username  

The following example shows how user user2 on machine venus would log in to machine starbug as user1.


venus$ rlogin starbug -l user1
Password:
Last login: Thu Nov  2 12:51:57 from venus
Sun Microsystems Inc.   SunOS 5.9       Generic February 2002
starbug$ pwd
/home/user1
starbug$ logout
Connection closed.
starbug$

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

rlogin to an Unknown Machine

If you try to log in to a remote machine unknown to your machine, rlogin searches unsuccessfully through the hosts database and then displays the following message.


$ rlogin stranger
stranger: unknown host
$

Aborting an rlogin Connection

Normally you terminate an rlogin connection by typing logout at the end of a work session. If cannot terminate a session in this manner, you can abort the connection by typing a tilde character followed by a period (~.). The remote 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, you are returned to your original machine.


venus$ rlogin starbug -l user2
Password:
Last login: Thu Nov  2 15:13:10 from venus
Sun Microsystems Inc.   SunOS 5.9       Generic February 2002
starbug$ ~.  (You may not see the ~ on the screen.)
Closed connection.
venus$

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


venus$ rlogin starbug -l user2
Password:
Last login: Thu Nov  2 15:14:58 from venus
Sun Microsystems Inc.   SunOS 5.9       Generic February 2002
starbug$ rlogin rlogin earth -l user2
Password:
Last login: Thu Nov  2 15:24:23 from starbug
Sun Microsystems Inc.   SunOS 5.9       Generic February 2002
earth$ ~~.  (You may not see the ~~ on the screen.)
Closed connection.
starbug$

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. You can also type the percentage sign (%) followed by the process number of the stopped process. If you do not specify a process number, % activates the process most recently suspended.


venus$ rlogin goddess -l user2
Password:
Last login: Thu Aug 31 14:31:42 from venus
Sun Microsystems Inc.   SunOS 5.9       Generic February 2002
goddess$ pwd
/home/user2
goddess$~^Z

Stopped (user)
venus$ pwd
/home/user2/veggies
venus$fg
rlogin goddess
goddess$ logout
venus$

You can also type two tildes and press Ctrl-Z to suspend the current rlogin and place you at an intermediate rlogin.

For more information on the rlogin(1) command, refer to the man Pages(1): User Commands.

Verifying Your Location (who am i)

After logging in to a variety of remote machines, you might need to verify where you are. Type who am i to display the name of the machine you are currently logged in to as well as your current login name.