next up previous contents index
Next: Mail Forwarding Up: Other Init Files Previous: FTP Defaults

Allowing Easy Remote Access to Your Account

If you have an .rhosts file in your home directory, it will allow you to run programs on this machine remotely. That is, you might be logged in on the machine, but with a correctly configured .rhosts file on, you could run a program on and have the output go to, without ever having to log in or type a password.

A .rhosts file looks like this:

The format is fairly straightforward: a machine name, followed by username. Suppose that that example is in fact my .rhosts file on That would mean that I could run programs on floss, with output going to any of the machines listed, as long as I were also logged in as the corresponding user given for that machine when I tried to do it.

The exact mechanism by which one runs a remote program is usually the rsh program. It stands for ``remote shell'', and what it does is start up a shell on a remote machine and execute a specified command. For example:


User trixie at, who had the example .rhosts shown previously, explicitly allows trixie at to run programs as trixie from floss.

You don't have to have the same username on all machines to make a .rhosts work right. Use the ``-l'' option to rsh, to tell the remote machine what username you'd like to use for logging in. If that username exists on the remote machine, and has a .rhosts file with your current (i.e.: local) machine and username in it, then your rsh will succeed.


This will work if user larry on has a .rhosts file which allows trixie from to run programs in his account. Whether or not they are the same person is irrelevant: the only important things are the usernames, the machine names, and the entry in larry's .rhosts file on floss. Note that trixie's .rhosts file on frobbo doesn't enter into it, only the one on the remote machine matters.

There are other combinations that can go in a .rhosts file--for example, you can leave off the username following a remote machine name, to allow any user from that machine to run programs as you on the local machine! This is, of course, a security risk: someone could remotely run a program that removes your files, just by virtue of having an account on a certain machine. If you're going to do things like leave off the username, then you ought to make sure that your .rhosts file is readable by you and no one else.

next up previous contents index
Next: Mail Forwarding Up: Other Init Files Previous: FTP Defaults

Converted on:
Mon Apr 1 08:59:56 EST 1996