Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages of rsh versus Perl's Expect.pm?

I have a Perl Expect.pm script that does some moderately complex stuff like packaging applications, deploying the application, checking for logs, etc. on multiple remote unix hosts.

My predecessor had written similar scripts using rsh.

Is there a better approach between the two? Or should I use something all together different?

I am guessing somebody will bring up SSH; it's basically replacement for rsh, right? Unfortunately, however SSH is not an option for me right now.

Another thing I should add is that after logging in I need to be able to SUDO to a particular user to do most of the actions on the remote hosts.

like image 971
Ville M Avatar asked Jan 21 '26 13:01

Ville M


2 Answers

Another thing I should add is that after logging in I need to be able to SUDO to a particular user to do most of the actions on the remote hosts.

To address this one particular point: using rsh (or ssh) you can specify which user to become in the remote session:

$ rsh -l username hostname

There's no need to use sudo in this case. Now would definitely be the time to look into ssh due to security issues. The syntax is the same, but ssh also allows a slightly different (and I'd say better) syntax:

$ ssh username@hostname

I found expect to be too finicky, but my experience with it is not substantial.

like image 171
Jon Ericson Avatar answered Jan 25 '26 18:01

Jon Ericson


They do different things. Expect is a way to script what would otherwise be manual responses. rsh -- remote shell, not restricted shell, an unfortunate name clash -- allows you to run commands remotely on another system.

That said, the security holes and other disadvantages of using rsh to do remote commands, run sudo, etc, are immense.

like image 30
Charlie Martin Avatar answered Jan 25 '26 19:01

Charlie Martin