Running command in remote machine

I am writing a script to run a command in a remote machine. I tried "rsh" but found out that it was not useful enough for my purpose. Then I tried "rexec" but it didnt work at all, everytime it shows the error "Connection Refused" is there any other method ? or can someone please suggest how to make rexec work ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


I'm not sure if there is an easier way, but with openssh you can do this. But rsh would be easier, I don't understand why you can't use rsh.

/Hans - Erik Skyttberg
rexec should prompt you for a password, but that's about the only difference from rsh...
To make rsh work, you need to put a .rhosts your home dir (at least in the remote box).

let'say you do it from box1 to box2, the both machine has the same login name. you put a .rhosts under you home dir, the format looks like:

box1-name your-login-name

please check your /etc/inetd.conf file to have in.rshd enable.

Use rsh, rpc is not secure ! I strongly recommended you to set up secure shell (ssh), openssh can be download from the web for your version of OS


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

OpenSSH (ssh in general) allows you to you hostbased auth with pre-setup keys.  Kind of tricky the first couple of setups but works great once you learn it.

why a C ?
Hi gopubhaskar

Please take a moment to read:

We value our experts who are investing their time and effort to solve Q's for others. That's why I kindly ask you to read the grading text and add a comment or the grade given fits the description or that I have to make a change.

When no comment has been added within 72 hrs I'll change the grade to an "A"

Thanks !


Community Support Moderator
Experts Exchange
changed the grade to an "A"


Community Support Moderator
Experts Exchange
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.