Using the Network
A network is a group of computers set up to communicate with one another. When your machine is part of a network, you have the opportunity to use the resources of other machines on the network while remaining logged in to your own machine. You can log in to other machines or you can execute remote commands that affect other machines from your own workstation.
This chapter describes the following topics.
If your machine is not currently attached to a network, the information presented here might not be relevant to your situation. However, it might be valuable for you to review this information to get an overall view of the benefits that networking can provide.
Networking Concepts
A network connection between machines enables these systems to transmit information to one another. The following list describes the more common network types.
Local area network (LAN) -- A network that ranges over a small area, generally less than a few thousand feet
Wide area network (WAN) -- A large network that can span thousands of miles
Campus area network (CAN) -- An intermediately sized network
A network that is composed of a linked group of networks is called an internetwork. For example, your machine might be part of a network within your building and part of an internetwork that connects your local network to similar networks across the country. Because the difference between a network and an internetwork is generally invisible to the user, the term network is used in this guide to refer to both networks and internetworks.
Networked machines use a network protocol, or common network language, to communicate. A network protocol ensures that information is transmitted to the appropriate location on the network. An internetwork protocol, sometimes referred to as a relay, links networks together.
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$ |