LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rsh xterm and running remote commands (https://www.linuxquestions.org/questions/linux-newbie-8/rsh-xterm-and-running-remote-commands-598116/)

TomT_90GT 11-08-2007 01:27 PM

rsh xterm and running remote commands
 
Hello all...

I'm stumped and hoping someone can provide an example or two.

I'd like to rsh (or ssh) into another machine on our network, open up an xterm displaying on my machine (and here's the tricky part), and then execute a command on the remote machine WITHOUT having to type it in the xterm, but rather somehow piping it into the rsh xterm command.

I've come this far:

rsh <remote_machine> xterm -display <my_machine>:0.0 -title TEST -geometry 72x12+0+0

This rshells into the <remote_machine>, and runs an xterm displaying on <my_machine>. However, I can't figure out how to run one or more commands ON that remote_machine so that they will display on <my_machine> on the open xterm, again WITHOUT having to manually type them into the xterm window.

I.e. How could I run a 'pwd' and 'ls' command on the remote_machine so that it would display the results on the xterm. I gather it should have something to do with piping in the 'pwd' and 'ls' to the rsh...xterm command line above, but I can't seem to find the right combination.

Thanks.

P.S. For now I'd be happy to just figure out the rsh method, but eventually my goal is to also do the above using passwordless ssh, but I can leave that for another day!

---Tom

jschiwal 11-09-2007 05:55 AM

I've never used rsh. Ssh is a more secure replacement. You can set it up so that the keys provide the authentication without entering a password. If you want to execute a command in xterm, you could use the -e option.

ssh -X user@host xterm -e command argument(s). I don't see the benefit in running xterm. You could run "ssh user@host command argument(s)". Since you are already running in a terminal.
If you always want the same command to run, that command can be entered in the "force command" option of sshd_config.

TomT_90GT 11-09-2007 08:56 AM

Still looking for an answer to this question...the goal of this is to run another script which will pop open several xterm windows and run different processes in each of these windows without having to type the commands in each window. The windows are more for monitoring the status. As an overly simplified example:

From Machine_A, run script "do_something" which will:

rsh (or ssh) into Machine_B and execute process_abc
==> display process_abc running on Machine_B on xterm running on Machine_A

rsh (or ssh) into Machine_C and execute process_xyz
==> display process_xyz running on Machine_C on xterm running on Machine_A

etc.

We used to have a script here at work which did this to start up a multiprocess program running on multiple machines all displaying windows (actually dtterms on Solaris). We've since moved on to something else, the script has been lost, but I'm trying to resurrect a version of it to run on our Suse Linux boxes.

Thanks.

jschiwal 11-09-2007 11:45 PM

Why can't the -e command argument of the xterm started by ssh be the script you want to run.


All times are GMT -5. The time now is 04:33 PM.