The Remote Shell is a command line client program that can execute the command as another user, and an another computer over the network. The rsh is a client that connects rshd server daemon, rhsd server daemon runs on tcp port no 514. Rshd does not support encryption so it is very insecure to use on the production environment, because it transfers the password plainly. Now a days rsh replaced by SSH.
Install rsh server.
[root@server ~]# yum -y install rsh rsh-server
Restart the server daemons.
[root@server ~]# systemctl restart rsh.socket
[root@server ~]# systemctl restart rlogin.socket
[root@server ~]# systemctl restart rexec.socket
[root@server ~]# systemctl enable rsh.socket [root@server ~]# systemctl enable rlogin.socket [root@server ~]# systemctl enable rexec.socket
Remote execution is controled by two files.
1. /etc/rhosts.equiv (All users except root)
2. $HOME/.rhosts (target server)
.rhosts file will be used only if the /etc/rhosts.equiv lookup is failed, both files contains list of hostname and user name which should be allowed to access.
The first column is the name of remote machines from which logins are allowed.
The second column is the name of the user who will be running rsh. If this is blank the username on the target is used.
Each of the two fields can be set to + to indicate a wildcard.
rsh -l username host_name remote_command
Disable firewall and SELinux security settings. To enable external root user to execute the command, Edit /etc/securetty file.
root@server ~]# vi /etc/securetty
Append the following.
rsh rexec rlogin