Howto - Enable rsh / rlogin On Linux Server

The rlogin and rsh are the remote login services provided by Linux. These services can be used to log in to a remote system and execute commands on it. Rlogin uses a hidden file called .rhosts that is present on the host machine. This file allows a machine to login without a password. This article describes how this rlogin service can be enabled on a machine to allow other machines to login to the system.

Enabling rlogin/rsh

The rlogin and rsh services are controlled by xinetd. Xinetd is a super daemon. Super daemon means that it manages other daemons or other services. Rlogin service is a xinetd managed service. It means that rlogin depends upon xinetd service. Thus, in order to enable or disable a service controlled by xinetd, we need to check the configuration of xinetd. The configurations of services controlled by xinetd reside in "/etc/xinetd.d" directory. The configuration file for rlogin/rsh is /etc/xinetd.d/rsh or in some newer versions of Linux, it might be /etc/xinetd.d/klogin file. This file looks like this:

# default: off
# description: The kerberized rlogin server accepts BSD-style rlogin sessions, \
# but uses Kerberos 5 authentication.
service klogin
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/kerberos/sbin/klogind
server_args = -5
disable = yes
}

This service is disabled by default. To enable it, change the value of "disable" to "no". Now restart the xinetd service so that the changes are read by the xinetd daemon:

$ service xinetd restart
Stopping xinetd: [ OK ] Starting xinetd: [ OK ]

That's all you need to enable rlogin. You can check with the following command:

[email protected]:~$ rlogin 192.168.1.10
[email protected]'s password:
Last login: Thu Nov 1 10:19:29 2012 from 192.168.1.15
[[email protected] ~]$ ls
Desktop

Now you can execute all the commands at the rlogin server at 192.168.1.10.

You might also consider checking the iptables firewall setting at the server if you are not able to access the service.

In the ~/.rhosts file, the best permissions for this file are:

"rw-------".

The client names stored in this file are full names such as

foo.bar.com jerry

Raghu 10:23 pm

About Raghu

Raghu is working as Linux Server Administrator in Acknown Technologies Pvt. Ltd. He has been using Linux from last 5 years. He completed his RHCE certification in 2009. He likes to read about Linux and other Open Source Technologies and write articles on these.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.

2 Comments

  1. Thank you for this useful information for setting up rlogin. Will it also work using /etc/host.equiv or only the ~/.rhosts method?

    1. Should work with both, take not that you should use /etc/hosts.equiv on a system-wide basis and ~/.rhosts for the individual user.