1854867 Members
35027 Online
104105 Solutions
New Discussion

Re: rlogin question

 
Edgar_10
Frequent Advisor

rlogin question

Hi,

How can i include a rlogin command or what is the correct syntax in a local script that will be able to execute/run commands on the remote host?

Thanks in advance!
9 REPLIES 9
Gary Yu
Super Advisor

Re: rlogin question

Hi Dean,

I think remote shell (remsh) is more suitable in your case.

Gary
John Poff
Honored Contributor

Re: rlogin question

Hi,

You might want to take a look at the 'remsh' command. You can do this:

remsh remotehost '/bin/ls somefile*'

or something like that. You'll have to have the .rhosts setup between the systems, which leaves open a security risk, but it will work.

JP
Robert-Jan Goossens
Honored Contributor

Re: rlogin question

Hi,

take a look at next command,

# man rexec

# rexec host [-l username] [-n] command

Hope it helps,

Robert-Jan.
Sridhar Bhaskarla
Honored Contributor

Re: rlogin question

Hi,

Use remsh.

remsh remote_host -l loginname -n your_command

If the local login and the remote login are the same, you can exclude '-l loginname' in the above command.

Just a friendly reminder that using 'r' commands is a security concern.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Edgar_10
Frequent Advisor

Re: rlogin question

Hi Gary,

Do you have an example of how i could use it? Man pages not that helpfull?

What I want 2 do is in a script on hosta remote login to hostb & shutdown an app & database?

Any ideas?

Thanks in advance!
Patrick Wallek
Honored Contributor

Re: rlogin question

Instead of rlogin, have a look at remsh. remsh is designed to go to the remote machine and run something.

# remsh remotemachine ls

Will do an ls on the remote machine.

Do a 'man remsh' for more information.
Sridhar Bhaskarla
Honored Contributor

Re: rlogin question

Hi,

Write a script on hostB to shutdown the application and the database on it. (say /home/appadmin/shutdown.sh

From hostA do

remsh hostB /home/appadmin/shutdown.sh

Make sure on hostB, you have the .rhosts file of the account that runs the script, setup properly for hostA.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Edgar_10
Frequent Advisor

Re: rlogin question

Hi All,

Thanks for all the insight, its most appreciated!!
Gary Yu
Super Advisor

Re: rlogin question

Hi Dean,

Sridhar has clearly described how to do it. one more thing to notice is, you better have same userID on both hosts, otherwise, you have to use "remsh hostb -l user_name script_name"

thanks,
Gary