[Next] [Previous] [Up] [Top] [Contents]

8.3 Remote Connections

8.3.3 Remote commands

A number of Unix machines can be connected together to form a local area network. When this is the case, it often happens that a user of one machine has valid login access to several of the other machines in the local network. There are Unix commands available to such users which provide convenience in carrying out certain common operations. Because these commands focus on communications with remote hosts in the local network, the command names begin with the letter "r": rlogin, rsh, and rcp. The remote access capability of these commands is supported (optionally) by the dotfile, ~/.rhosts, for individual users and by the system-wide file /etc/hosts.equiv. For security reasons these may be restricted on some hosts.

The rlogin command allows remote login access to another host in the local network. rlogin passes information about the local environment, including the value of the TERM environment variable, to the remote host.

The rsh command provides the ability to invoke a Unix shell on a remote host in the local network for the purpose of executing a shell command there. This capability is similar to the "shell escape" function commonly available from within such Unix software systems as editors and email.

The rcp command provides the ability to copy files from the local host to a remote host in the local network.

Syntax

rlogin [ -l username ] remote_host

rsh [ -l username ] remote_host [ command ]

rcp [ [user1]@host1:]original_filename [ [user2]@host2:]new_filename

where the parts in brackets ([]) are optional. rcp does not prompt for passwords, so you must have permission to execute remote commands on the specified machines as the selected user on each machine.

Common Options

-l username connect as the user, username, on the remote host (rlogin & rsh)

The .rhosts file, if it exists in the user's home directory on the remote host, permits rlogin, rsh, or rcp access to that remote host without prompting for a password for that account. The .rhosts file contains an entry for each remote host and username from which the owner of the .rhosts file may wish to connect. Each entry in the .rhosts file is of the form:

remote_host remote_user

where listing the remote_user is optional. For instance, if Heather Jones wants to be able to connect to machine1 (where her username is heather) from machine2 (where her username is jones), or from machine 3 (where her username is heather, the same as for machine1), she could create a .rhosts file in her home directory on machine1. The contents of this file could be:

machine2 jones

machine3

--or--

machine2 jones

machine3 heather

On a system-wide basis the file /etc/hosts.equiv serves the same purpose for all users, except the super-user. Such a file with the contents:

remote_machine

allows any user from remote_machine to remote connect to this machine without a password, as the same username on this machine.

An /etc/hosts.equiv file with the contents:

remote_machine remote_user

allows remote_user, on remote_machine, to remote connect to this machine as any local user, except the super-user.

/etc/hosts.equiv and ~/.rhosts files should be used with caution.

The Secure SHell (SSH) versions of the rcp, rsh, and rlogin programs are freely available and provide much greater security.


Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]