Saturday, August 22, 2015

Setting up rsh on two Redhat 6 servers

Setting up rsh on two Redhat 6 servers

Environment:

1. Two redhat 6 servers hostnames: 1. redhat_1, 2. redhat_2
2. Rsh packages required: rsh.x86_64, rsh-server.x86_64
3. IP address:
    redhat_1: 192.168.2.3 redhat_2: 192.168.2.4
4. Turn off the firewall and SElinux on both machines.

Introduction:

The rsh service comes under xinetd.

Steps:

Perform the below steps on both the machines..!!!!!!!


Turn off firewall and SELinux on both the machines as follows.

Links:

To turn off firewall:


1.  /etc/init.d/iptables - IPv4 iptables firewall service.
2. /etc/init.d/ip6tables - IPv6 iptables firewall service.

To disable firewall run the below command:

service iptables save
service iptables stop
chkconfig iptables off



Red Enterprise Linux Disable Iptables IPv4 Firewall

To turn off IP6 firewall:

# service ip6tables save
# service ip6tables stop
# chkconfig ip6tables off

To turn off the firewall service permanently:

[root@redhat_2 ~]# chkconfig iptables off

To check the fireall  service startup status:

[root@redhat_2 ~]# chkconfig --list iptables
iptables       0:off 1:off 2:off 3:off 4:off 5:off 6:off

To verify firewall is disabled or not:

/sbin/iptables -L -v -n

Turn off SELinux:

Link:

To turn off SELinux

http://www.cyberciti.biz/faq/howto-turn-off-selinux/


Disable SELinux temporarily:

setenforce 0

Disable SELinux permanently edit the below file:

vi /etc/sysconfig/selinux

Change the SELINUX parameter in the file:

SELINUX=disabled


REBOOT the machine for the effect to take place:

reboot

Finally setting up rsh environment:

Links:

http://people.redhat.com/kzak/docs/rsh-rlogin-howto.html
http://www.itzgeek.com/how-tos/linux/centos-how-tos/setup-remote-shell-access-on-centos-6-rhel-6.html

1. Install the rsh packages on both the machines if not installed already.

To check if installed already run:

yum list installed "*rsh*"

To install the packages:

yum install rsh.x86_64
yum install rsh-server.x86_64

Edit the rsh configuration file to enable rshd server daemon:

/etc/xinetd.d/rsh

Change disabled from Yes to NO if not set already.

disable                = no


Restart the xinetd service.

service xinetd restart

Editing  /etc/securetty on both the servers and include the below entries to the end:

rsh
rlogin
rexec

Creating .rhosts file:

The .rhosts file must be modified to include the names of the remote workstations, file should be under the home directory of the user who’s account is going to be used to execute the commands over a network.

vi ~/.rhosts

redhat_1
redhat_2

Make sure that .rhosts entries are pingable from both the servers, add the entries to /etc/hosts or DNS.

Creating hosts file:

Any user from the above systems can execute the command as root.

Add a full permission to use the command over the network. Plus sign will give a full permission.

vi /etc/hosts.equiv + +

Enable rsh, rlogin, rexec, xinetd services to start in boot:

chkconfig rsh on
chkconfig rlogin on
chkconfig rexec on

chkconfig xinetd on

Testing rsh:

Run the below command:

rsh redhat_2 uptime

[root@redhat_1 ~]# rsh redhat_2 uptime
 06:04:38 up  2:44,  4 users,  load average: 0.00, 0.00, 0.00