rsh
is used to execute commands on a remote machine.
The rsh command executes the
command or a program in another host from current working machine without having to login into that
remote machine by entering a password as
in ssh. You can run any unix command, or a shell script of a remote host.
Requirement :-
Remote Machine access without password.
Server
:- 192.168.0.10 Server.example.com
Client:-192.168.0.11 client.example.com
192.168.0.10 server.example.com
User :- test
192.168.0.11 client.example.com
User :- test1
1.Both Machine in /etc/hosts file :-
192.168.0.10 server.example.com server
192.168.0.11 client.example.com client
2.Install some package at Server.example.com :-
# yum install
xinetd
# yum install rsh-server rsh*
# rpm -qa|grep -i ^rsh-server
Server side :-
3.Now you need to Edit /root/.rhosts to add lists of hosts that can access without password. If you want to allow access to everyone without password, you need to put '+' in the file. A '+' indicates allowing everyone.
# vi /root/.rhosts
client.example.com root
cilent.example.com test1
# chmod 600
/root/.rhosts
4.test1 user access all data from server machine as a user test.:-
#vim /home/test/.rhosts
client.example.com test1
Note :-Test1 user access remote machine “server.example.com” and login as a test user.
5.Add a full permission to use the command over the network. Plus sign will give a full permission.
vi /etc/hosts.equiv + +
6.Now you need to allow RSH , RLogin and Rexec to be used. Open these files one by one and then set the "disable=no"
/etc/xinetd.d/rsh ,
/etc/xinetd.d/rlogin
/etc/xinetd.d/rexec
7. Now you need to modify the file to allow password less to the machine.
a)/etc/pam.d/rlogin
b)/etc/pam.d/rsh
c)/etc/pam.d/rexec
BEFORE: auth required pam_rhosts_auth.so
AFTER : auth required pam_rhosts_auth.so promiscuous
8.Enable to services :-
# chkconfig rsh on
# chkconfig rexec on
# chkconfig rlogin on
# chkconfig xinetd on
9.Restart xinetd
service:-
# service xinetd restart
10.Add line in /etc/securetty :-
rsh,
rlogin
rexec
Client side :-
11.Testing on client.example.com, rlogin and rsh to nodes without passwords:-
# yum install rsh
As a login “root” user and run below commands :-
# rlogin 192.168.0.10
# rsh 192.168.0.10
# rsh 192.168.0.10 -l root ls -al /tmp
As a login “test1” user and run below command :-
# rsh 192.168.0.10 -l test
# rsh 192.168.0.10 -l test ls -al /tmp
# rsh 192.168.0.10 -l root
12.Copy data command :-
# rcp –r data test@server.example.com:
# rcp –r file test@server.example.com:data
13.check port for rsh :-
# netstat -n --inet
No comments:
Post a Comment