need help scripting multiple xfree startups

Thomas Chadwick j_tetazoo@hotmail.com
Mon Jul 22 06:33:00 GMT 2002


>From: "Dennis Foreman" <dforeman@stny.rr.com>
>Reply-To: <dforeman@stny.rr.com>
>To: <cygwin-xfree@cygwin.com>
>Subject: need help scripting multiple xfree startups
>Date: Sun, 21 Jul 2002 14:30:18 -0400
>
[snip]
>
>I need to repeat this 8 more times for each of 8 different machines. Is
>there some way of automating this? (Yes, I know a script will do it. I need
>some detailed help on what to put in the script.) Especially eliminating
>having to type a pw every time

There is plenty of information about this in the ssh man page.  Here's a 
quick recipe:

1) Open a Cygwin bash window and cd into ~/.ssh (if the directory doesn't 
exist, create it).
2) Run "ssh-keygen -t rsa1".  Accept the default filename of ~/.ssh/identity 
and use a blank passphrase.  PROTECT THIS FILE!  Anyone who gets ahold of it 
can use it as if they were you and gain access to systems without a password 
or passphrase.  Consider yourself warned!
3) FTP the resulting file named identity.pub onto each of the target systems 
and put it in /tmp (DO NOT put it in ~/.ssh).
4) On each remote system, append the contents of the identity.pub file to 
the file ~/.ssh/authorized_keys:

    cat /tmp/identity.pub >> ~/.ssh/authorized_keys

5) At this point, you should be able to ssh to each remote system and get in 
without being prompted for a password.

>and clicking to establish the Xwindow on the
>X desktop.
>
>regards,
>D. J. Foreman
>website: http://WWW.CS.Binghamton.EDU/~foreman

I'd say you've already figured out most of this part.  To automatically 
launch an xterm and have it run a command on a remote machine, put the 
following command in your favorite X startup script (e.g. startxwin.bat, 
startxwin.sh, or .xinitrc) in the same section where you see other xterms 
being launched (I've put backslashes to indicate that this should all be on 
1 line):

ssh -X -l remote_username remote_hostname \
xterm -title "remote_username@remote_hostname" \
-e remote_command

If you're putting this in startxwin.bat, you may need to preceed it with 
"run" or "start" (I don't know for sure, I don't use that script).  If 
you're putting it in startxwin.sh or .xinitrc, append an ampersand ("&") to 
the end.

Want it to act on 8 other machines?  Repeat the same command 8 more times 
with a different value for remote_machine each time.

As for getting the xterm to place itself on your screen without having to 
click:  If you're using the default Window Manager twm, copy the file 
/usr/X11R6/lib/X11/twm/system.twmrc to ~/.twmrc.  Then edit ~/.twmrc and add 
"RandomPlacement" on a line by itself towards the top of the file just after 
the comments.  If you're using some other window manager, then consult its 
man page.


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com



More information about the Cygwin-xfree mailing list