The rlogin command enables you to log in to a remote system. Once logged in, you can navigate through the remote file system and manipulate its contents (subject to authorization), copy files, or execute remote commands.
If the system you are logging into is in a remote domain, be sure to append the domain name to the system name. In this example, SOLAR is the name of the remote domain:
rlogin pluto.SOLAR
Also, you can interrupt a remote login operation at any time by typing Control-d.
Authentication (establishing who you are) for rlogin operations can be performed either by the remote system or by the network environment.
The main difference between these forms of authentication lies in the type of interaction they require from you and the way they are established. If a remote system tries to authenticate you, you will be prompted for a password, unless you set up the /etc/hosts.equiv or .rhosts file. If the network tries to authenticate you, you won't be asked for a password, since the network already knows who you are. The figure below shows a simplified illustration to describe authentication for remote logins.
When the remote system attempts to authenticate you, it relies on information in its local files; specifically if:
Your system name and user name appears in the remote system's /etc/hosts.equiv file, or
Your system name and user name appears in the remote user's .rhosts file, under the remote user's home directory
Network authentication relies on one of these two methods:
A "trusting network environment" that has been set up with your local network information service and the automounter
One of the network information services pointed to by the remote system's /etc/nsswitch.conf file contains information about you
Network authentication generally supersedes system authentication.
The /etc/hosts.equiv file contains a list of trusted hosts for a remote system, one per line. If a user attempts to log in remotely (using rlogin) from one of the hosts listed in this file, and if the remote system can access the user's password entry, the remote system allows the user to log in without a password.
A typical hosts.equiv file has the following structure:
host1 host2 user_a +@group1 -@group2 |
When a simple entry for a host is made in hosts.equiv, such as the entry above for host1, it means that the host is trusted, and so is any user at that machine.
If the user name is also mentioned, as in the second entry in the example, then the host is trusted only if the specified user is attempting access.
A group name preceded by a plus sign (+) means that all the machines in that netgroup are considered trusted.
A group name preceded by a minus sign (-) means that none of the machines in that netgroup are considered trusted.
The /etc/hosts.equiv file presents a security risk. If you maintain a /etc/hosts.equiv file on your system, you should include only trusted hosts in your network. The file should not include any host that belongs to a different network, or any machines that are in public areas. (For example, do not include a host that is located in a terminal room.)
This can create a serious security problem. Either replace the /etc/hosts.equiv file with a correctly configured one, or remove the file altogether.
A single line of + in the /etc/hosts.equiv file indicates that every known host is trusted.
The .rhosts file is the user equivalent of the /etc/hosts.equiv file. It contains a list of host-user combinations, rather than hosts in general. If a host-user combination is listed in this file, the specified user is granted permission to log in remotely from the specified host without having to supply a password.
Note that a .rhosts file must reside at the top level of a user's home directory. .rhost files located in subdirectories are not consulted.
Users can create .rhosts files in their home directories. Using the .rhosts file is another way to allow trusted access between their own accounts on different systems without using the /etc/hosts.equiv file.
Unfortunately, the .rhosts file presents a major security problem. While the /etc/hosts.equiv file is under the system administrator's control and can be managed effectively, any user can create a .rhosts file granting access to whomever the user chooses without the system administrator's knowledge.
In a situation in which all of the users' home directories are on a single server and only certain people have superuser access on that server, a good way to prevent a user from using a .rhosts file is to create an empty file as superuser in their home directory. You would then change the permissions in this file to 000 so that it would be difficult to change it, even as superuser. This would effectively prevent a user from risking system security by using a .rhosts file irresponsibly. It would not, however, solve anything if the user is able to change the effective path to his or her home directory.
The only secure way to manage .rhosts files is to completely disallow them. See "How to Search for and Remove .rhosts Files" for detailed instructions. As system administrator, you can check the system often for violations of this policy. One possible exception to this policy is for the root account--you might need to have a .rhosts file to perform network backups and other remote services.
Provided your system is configured properly, you can link remote logins. In this example, a user on earth logs in to jupiter, and from there decides to log in to pluto:
Of course, the user could have logged out of jupiter and then logged in directly to pluto, but this type of linking can be more convenient.
To link remote logins without having to supply a password, you must have the /etc/hosts.equiv or .rhosts file set up correctly.
The rlogin command allows you to log in to a remote system directly or indirectly, as shown in the figure below.
A direct remote login is attempted with the default user name; that is, the user name of the individual currently logged in to the local system. This is the most common form of remote login.
An indirect remote login is attempted with a different user name, which is supplied during the remote login operation. This is the type of remote login you might attempt from a workstation that you borrowed temporarily. For instance, if you were in a coworker's office and needed to examine files in your home directory, you might log in to your system remotely, from your coworker's system, but you would perform an indirect remote login, supplying your own user name.
The dependencies between direct and indirect logins and authentication methods are summarized in the table below.
Table 10-1 Dependencies Between Login Method and Authentication Method (rlogin)
Type of Login |
User Name Supplied By |
Authentication |
Password |
---|---|---|---|
Direct |
System |
Network |
None |
|
|
System |
Required |
Indirect |
User |
Network |
None |
|
|
System |
Required |
When you log in to a remote system, the rlogin command attempts to find your home directory. If the rlogin command can't find your home directory, it will assign you to the remote system's root (/) directory. For example:
Unable to find home directory, logging in with / |
However, if the rlogin command finds your home directory, it sources both your .cshrc and .login files. Therefore, after a remote login, your prompt is your standard login prompt, and the current directory is the same as when you log in locally.
For example, if your usual prompt displays your system name and working directory, and when you log in, your working directory is your home directory, your login prompt looks like this:
earth(/home/smith): |
Then when you log in to a remote system, you will see a similar prompt and your working directory will be your home directory, regardless of the directory from which you entered the rlogin command:
earth(/home/smith): rlogin pluto . . . pluto(/home/smith): |
The only difference is that the name of the remote system would take the place of your local system at the beginning of the prompt. Where, then, is the remote file system? It is parallel to your home directory, as shown below:
In other words, if you cd to /home and then run ls, this is what you'll see:
earth(home/smith): cd .. earth(/home): ls smith jones |
Search for and remove .rhosts files by using the find(1) command.
# find home-directories -name .rhosts -print -exec rm{} |
home-directories |
Identifies the path to a directory where users' home directories are located. Note that you can enter multiple paths to search more than one home directory at a time. |
-name .rhosts |
Identifies the filename. |
|
Prints the current pathname. |
-exec rm {} \; |
Tells the find command to apply the rm command to all files identified using the matching filename. |
The find command starts at the designated directory and searches for any file named .rhosts. If it finds any, it prints the path on the screen and removes it.
The following example searches and removes .rhosts files in all the user's home directories located in the /export/home directory.
# find /export/home -name .rhosts -print | xargs -i -t rm{} |
Find out if a remote system is operating by using the ping command.
$ ping system-name | ip-address |
system-name |
The name of the remote system. |
ip-address |
The IP address of the remote system. |
The ping command returns one of three messages:
Status Message |
Explanation |
---|---|
system-name is alive |
The system can be accessed over the network. |
ping:unknown host system-name |
The system name is unknown. |
The system is known, but is not currently operating. |
If the system you "ping" is located in a different domain, the return message can also contain routing information, which you can ignore.
The ping command has a time-out of 20 seconds. In other words, if it does not get a response within 20 seconds, it returns the third message. You can force ping to wait longer (or less) by entering a time-out value, in seconds:
$ ping system-name | ip-address time-out |
For more information, see ping(1M).
Find who is logged in to a remote system by using the rusers(1) command.
$ rusers [-l] remote-system-name |
rusers |
(No options) Displays the name of the system followed by the name of users currently logged in to it, including root. |
-l |
Displays additional information about each user: the user's login window, login time and date, amount of time logged in, and the name of the remote system from which the user logged on. |
The following example shows the short output of rusers.
$ rusers pluto pluto smith jones |
In the following example, the long version of rusers show that two users are logged in to the remote system starbug. The first user logged in from the system console on September 10 and has been logged on for 137 hours and 15 minutes. The second user logged in from a remote system, mars, on September 14.
$ rusers -l starbug root starbug:console Sep 10 16:13 137:15 rimmer starbug:pts/0 Sep 14 14:37 (mars) |
Log in to a remote system using the rlogin(1) command.
$ rlogin [-l user-name] system-name |
rlogin |
(No options) Logs you in to the remote system directly; in other words, with your current user name. |
-l user-name |
Logs you into the remote system indirectly; in other words, with the user name you supply. |
If the network attempts to authenticate you, you won't be prompted for a password. If the remote system attempts to authenticate you, you will be asked to provide a password.
If the operation succeeds, the rlogin command displays brief information about your latest remote login to that system, the version of the operating system running on the remote system, and whether you have mail waiting for you in your home directory.
The following example shows the output of a direct remote login to pluto. The user has been authenticated by the network.
$ rlogin starbug Last login: Mon Jul 12 09:28:39 from venus Sun Microsystems Inc. SunOS 5.8 February 2000 starbug: |
The following example shows the output of an indirect remote login to pluto, with the user being authenticated by the remote system.
$ rlogin -l smith pluto password: user-password Last login: Mon Jul 12 11:51:58 from venus Sun Microsystems Inc. SunOS 5.8 February 2000 starbug: |
Log out from a remote system by using the exit(1) command.
$ exit |
This example shows the user smith logging out from the system pluto.
$ exit pluto% logout Connection closed. earth% |