How to configure rsh CentOS/RHEL 6


The rsh, rlogin, and rexec server should only be run on a system after carefully considering the security implications as this service offers very little security. It is strongly recommended that the OpenSSH package and SSH server (sshd) be used for better security.


In order to run an rsh, rlogin, and rexec server, the rsh-server package is required. It may be installed from your installation CDs using the rpm command:

# rpm -ivh rsh-server-*.rpm

Alternatively, if you have your system registered with Red Hat Network (RHN), you may install it using up2date or yum if you have the 5 or later version of Red Hat Enterprise Linux:

# up2date -i rsh-server


# yum install rsh-server


Follow the steps below:

1. Add hostname/username which should be accept to connect to the server into either of .rhosts or /etc/hosts.equiv file. ~/.rhosts is used for each users which should be accepted to access to the server as its user.

The following example that ’testuser’ from ’’ is accepted to access to ‘geek’ user on rsh server.

# cat /home/geek/.rhosts testuser    ### Accessing from testuser of is accepted

Modify the permission of ‘~/.rhosts’ file to ‘600’.

$ chmod 600 ~/.rhosts

/etc/hosts.equiv is a configuration file working for the whole system of rsh server allowed to access.

The following example that ’testuser’ from ’’ can access, and all user from also.

# /etc/hosts.equiv testuser  ← Accessing from testuser of is accepted           ← All from is accepted

2. Change both of rsh and rlogin services to ‘active’ mode with chkconfig command, and then restart ‘xinetd’ service.

# chkconfig rsh on
# chkconfig rlogin on
# chkconfig rexec on
# service xinetd start

3. Ensure TCP Port 513/514 are open on the remote server to accept connections.

4. Accessing to the rsh server by rsh command(login to ’testuser’ user from client side).

$ /usr/bin/rsh -l testuser

In case you would like ‘root’ user on the rsh server allowed to access, adding ‘rsh’ and ‘rlogin’ into /etc/securetty file is necessary. Plus, modifying /root/.rhosts is also needed.