Unix tip: Inter-host trust on Unix, part 1

By Sandra Henry-Stocker  7 comments

There are several ways to establish a relationship between Unix systems such that you can issue commands on one system that are run on another and, in particular, allow you to do so without the encumbrance of entering a password. The primary reason why most
of us want to do this is, of course, so that we can issue commands in scripts that run non-interactively. Another reason is that, should you lose control of the root password on a system, you can reset it easily if you log into a system the host trusts and issue the passwd command from there.

The primary drawback to inter-host trust is that it runs the risk of being exploited. If someone gains root access on a system that other systems trust, they can take over the other systems as well. In practice, most trusted systems are set up with a much higher level of security and limited accounts to lessen the likelihood that no one who is not authorized can gain a position of power over the trusting systems.

Trust isn't confined to the root account. Users can set up their own inter-host trust such that they can issue commands on one system that are run under their username on another system and do so in scripts. A simple example might be a script that reports who is logged into each system in a group. If a developer, for example, is looking to work on a server that is not currently being used by other developers, he might want to scan the systems to see who is logged on where.

One trust mechanism is through use of the /etc/hosts.equiv file. This file sets up system-wide trust between systems. If the /etc/hosts.equiv on host1 contains "host2", then any user on host2 can issue rsh (remote shell) commands to host1.

If you add a "+" sign after a host name in the /etc/hosts.equiv file, users on the trusted system can issue commands on the trusting system as any user. For example, fred can run the command "rsh host1 -l barney mkdir /tmp/barney" and create a directory in /tmp that is both owned by and named "barney". Similarly, a "+ +" entry would allow any user on any host to do the same.

While a "lewis +" entry would allow users on lewis to run rsh commands on the local system under any username, a "+ lewis" entry would allow a user named lewis to run commands from any host.

The extra openness afforded by the + entries are rarely used because of the abuses they might invite. Fortunately, superuser access bypasses /etc/hosts.equiv altogether, so there are important limits on how far the abuse can go.

Access is generally denied by omitting hosts from the /etc/hosts.equiv file. You can explicitly deny access by preceding a hostname with a minus (-) sign, but individual users can still set up personal .rhosts files and override this setting.

You can also deny a specific user from a specific host by putting the equivalent of "host2 -barney" in /etc/hosts.equiv but, again, this restriction can be overridden by the user. If you get really serious about restricting users' .rhosts file, you could create a root-owned .rhosts file in their home directories, but this is a privilege you should take away from users without very good reason since it can greatly facilitate their work.

The rsh command is subject to CONSOLE constraints set up in /etc/default/login. If you intend to use rsh (or rlogin) to log in to a remote system without a password, your access will depend on whether you allow root login on other than the system console. Look for the CONSOLE line in the /etc/default/login file to determine whether root login is allowed on other than the console (#CONSOLE) or restricted to console (CONSOLE).

The order of processing rsh configuration files can be important to understanding how they work. The /etc/hosts.equiv file is read first when an rsh command is invoked, then the appropriate .rhosts file is read. If a user is blocked in /etc/hosts.equiv and allowed in his .rhosts file, he may still be able to run remote commands. This works on my Solaris systems. Run some tests on your systems if you need to be sure how the two files interact.

7 comments

    Anonymous 45 weeks ago
    I also has to choose an offensive word but still agree with other guys.PLAVEB ecommerce solutions
    Anonymous 1 year ago
    Through a multistep process, starting from scratch, the SSH-1 client and server agree on an encryption algorithm and generate and share a secret session key, establishing a secure connection and really helpful on the client side.web development
    Anonymous 1 year ago
    o buy Rolex on line! Find Rolex Watches online sale, cheap Rolex Watches for sale, Rolex Watches sale for cheap, discount Rolex replica Watches on sale, Rolex Watch online sale, cheap Rolex Watch for sale, Rolex Watch sale for cheap,Rolex replica Watch on sale, cheap rolex mens watches online for sale, Rolex Ladies Watches cheap on sale.cheap rolex mens watch online store, Rolex Ladies Watch on sale.
    Anonymous 2 years ago
    大阪でバッテリー販売。 セルモーターリビルト。 オルタネーターリビルト。リビルト在庫多数。大阪で電装品販売。リンク品在庫多数。大阪でウイング車モーター修理・販売・在庫多数。大阪でパワーゲート車モーター修理・販売・在庫多数。
    Anonymous 3 years ago
    I agree with the first two posts in that no one in their right mind should use any of the r-protocols on the public Internet. However, the article is an interesting look at how UNIX systems once operated, and it may very well be useful to someone dealing with a legacy system, or, for that matter, just a couple systems that are newer but relatively isolated from the outside world (even in a different segment of an internal network).
    Anonymous 3 years ago
    I second the first post! This guy hasn't a clue what he is talking about. They shouldn't even be packaging that old shit anymore without crazy warnings. SSH is all you need or want.
    Anonymous 3 years ago
    What the @#$%^& is this author thinking?!?! Writing such an article promoting the "capabilities" of the r-family of protocols in 2009! This belongs in 1985. NEVER use any of these protocols for ANY reason -- they are heinously insecure and expose any system networked to the outside world to a myriad of vulnerabilities (can you say 'clear text passwords'?)Google on 'ssh'. It's your modern Swiss-army knife that will do ANY of these tasks and more in a secure fashion. And if you have trust and need to forgo passwords, have a read on 'known hosts' and the ssh configuration files.Repeat: NEVER use ANY of the obsoleted r-family protocols -- the Internet isn't honest anymore.

      Add a comment

      Post a comment using one of these accounts
      Or join now
      At least 6 characters

      Note: Comment will appear soon after you have activated your account.
      Obscene/spam comments will be removed and accounts suspended.
      The information you submit is subject to our Privacy Policy and Terms of Service.

      ITworld LIVE

      Ask a question

      Ask a Question