LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 11-08-2007, 02:27 PM   #1
TomT_90GT
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Rep: Reputation: 0
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
 
Old 11-09-2007, 06:55 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
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.
 
Old 11-09-2007, 09:56 AM   #3
TomT_90GT
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
Old 11-10-2007, 12:45 AM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DISPLAY vs. rsh for remote X applications jhwilliams Linux - Software 1 07-05-2007 12:06 AM
ssh running remote commands Nikee Linux - Security 5 02-04-2006 04:00 AM
Having problems with RSH commands bbalzer Linux - General 2 11-03-2005 06:58 AM
rsh rlogin xterm and vncserver missing in mandrake10.1 nanjil Mandriva 0 07-18-2005 06:05 PM
RSH (remote shell) maseby Linux - Newbie 1 01-22-2005 08:54 PM


All times are GMT -5. The time now is 12:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration