LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   need to connect from one Linux machine to another using RSH theough a script (https://www.linuxquestions.org/questions/linux-general-1/need-to-connect-from-one-linux-machine-to-another-using-rsh-theough-a-script-645619/)

satya kiran 05-29-2008 11:51 AM

need to connect from one Linux machine to another using RSH theough a script
 
I want to connect from one Linux machine to another machine in a network through RSH and using Shell scripting I should login to the remote machine and I should execute the commands on remote machine so is it possible?

If so can you let me know how can I write shell script using RSH only.

Currently when I run the command from one Linuc machine

rsh 172.18.25.211 -l root

where 172.18.25.211 is the remote machine which is connected in a network over which I am running the command

but I am getting the error connection refused.

So is RSH is a good solution in connecting to the remote machine and executing the scripts

Can you hep me out regarding this.

custangro 05-29-2008 12:00 PM

On the destination machine...add the ip address into the .rhosts file in root's home directory.

-C

satya kiran 05-29-2008 12:11 PM

Quote:

Originally Posted by custangro (Post 3168322)
On the destination machine...add the ip address into the .rhosts file in root's home directory.

-C

I didnt find the file .rhosts in the roots home directory

custangro 05-29-2008 02:44 PM

Quote:

Originally Posted by satya kiran (Post 3168326)
I didnt find the file .rhosts in the roots home directory

You have to make it.

-C

chrism01 05-29-2008 08:22 PM

If at all possible use ssh instead. rsh and friends are plain text protocols, so your name/passwd/data are avail to anyone who cares to look.
http://www.informit.com/articles/art...p=169465&rll=1

custangro 05-29-2008 11:20 PM

Quote:

Originally Posted by chrism01 (Post 3168755)
If at all possible use ssh instead. rsh and friends are plain text protocols, so your name/passwd/data are avail to anyone who cares to look.
http://www.informit.com/articles/art...p=169465&rll=1

if you use rsh and a .rhosts file; a password isn't required...although you can set up ssh to not have a password.

I'd would recommend using passwordless ssh over rsh.

-C

satya kiran 05-30-2008 01:22 AM

how to configure the rsh service
 
I have installed the rsh service in my two linux machines which are in a network and I having .rhost file within the home directory where i mentioned the IP adress of the remote machine but still I am getting connection refused.
The reason behind is the rsh RPM package has been installed and I don't no how to configure this in order to use this service can you provide me the steps to configure and use this service

satya kiran 05-30-2008 01:27 AM

Can you provide me link or steps to use the passwordless ssh service
 
Quote:

Originally Posted by custangro (Post 3168895)
if you use rsh and a .rhosts file; a password isn't required...although you can set up ssh to not have a password.

I'd would recommend using passwordless ssh over rsh.

-C

Hi when I run the command from my machine

ssh 172.18.25.211 (where 172.18.25.211 remote machine connected in a network to my linux machine)
It will prompt for the Password, so here I need to type the Password manually

but I want to give the password through script so how is it possible are there any options or

Like RSH I can login to the remote machine without the Password

chrism01 05-30-2008 01:53 AM

Don't put the passwd in a script, google 'ssh authorised keys' for a passwordless login. Uses ssh keys/certs instead.

satya kiran 05-30-2008 03:25 AM

steps to use RSH and how to configure
 
Quote:

Originally Posted by chrism01 (Post 3168985)
Don't put the passwd in a script, google 'ssh authorised keys' for a passwordless login. Uses ssh keys/certs instead.

Hi

As I am having an existing scipt usding RSH so I am trying with it but I want to know how to configure and use RSH mean while I will try to use SSH

satya kiran 05-30-2008 03:36 AM

Getting the error "connection refused" when using RSH
 
I am getting the following error when I try to connect to remote host using the following command

[root@rhel4 qauser1]# rsh 172.18.25.210 -l qauser1
connect to address 172.18.25.210: Connection refused
Trying krb4 rlogin...
connect to address 172.18.25.210: Connection refused
trying normal rlogin (/usr/bin/rlogin)
172.18.25.210: Connection refused

In my remote machine you can look into the following file

[root@rhel3 qauser1]# cat .rhosts
172.18.25.211 qauser1

I think RSH is not properly configured so can you help me out to solve this problem

As I am running some Automation scripts and in that one of the script is failing when it is trying to connect to the remote machine

So can you provide any other ALternative Using SSH through a script I need to connect to a remote machine

custangro 05-30-2008 09:59 AM

Quote:

Originally Posted by satya kiran (Post 3169060)
I am getting the following error when I try to connect to remote host using the following command

[root@rhel4 qauser1]# rsh 172.18.25.210 -l qauser1
connect to address 172.18.25.210: Connection refused
Trying krb4 rlogin...
connect to address 172.18.25.210: Connection refused
trying normal rlogin (/usr/bin/rlogin)
172.18.25.210: Connection refused

In my remote machine you can look into the following file

[root@rhel3 qauser1]# cat .rhosts
172.18.25.211 qauser1

I think RSH is not properly configured so can you help me out to solve this problem

As I am running some Automation scripts and in that one of the script is failing when it is trying to connect to the remote machine

So can you provide any other ALternative Using SSH through a script I need to connect to a remote machine

Do this

Code:

root@host# rsh 172.18.25.210 cat /dev/null
What does this return?

-C

satya kiran 05-31-2008 12:37 AM

how to configure RSH
 
Quote:

Originally Posted by custangro (Post 3169388)
Do this

Code:

root@host# rsh 172.18.25.210 cat /dev/null
What does this return?

-C


It says command not found

custangro 05-31-2008 10:38 AM

Quote:

Originally Posted by satya kiran (Post 3170049)
It says command not found

You need to put the ip adress in roots home directory on the machine you want to access...For instance If you want hostA to rsh to hostB then put the .rhosts file on hostB then issue the command from hostA. Also you need to put JUST THE IP ADDRESS not the user name in the .rhosts file.

Further more, you must update the /etc/hosts file on both machines so that they can "see" each other. Also remember that if you have a firewall in place (even software firewall); it may not work. On most Linux distros there is a built in firewall and you need to allow rsh.

Hope this helps....also make sure that rsh is installed.

I'd recommend ssh however. Read this

<http://blogs.translucentcode.org/mick/archives/000230.html>

-C


All times are GMT -5. The time now is 09:47 PM.