Well depending on how many commands you want to run, you can just use
ssh. For example.
[timh@yoda timh]$ ssh chewbacca cat .aliases | grep root | wc -l
timh@chewbacca's password:
3
So I ssh'd to CHEWBACCA, cat'd the .aliases file I have in my root
directory. grep'd out the word root, then piped it through wc. (Word
Count. The -l counts how many lines have the word root in them) It
then returns the information just as if I were on that machine.
Now if you need to run a couple of commands you can do several things.
Write a script on the remote machine to do the work you need. Then ssh
to the machine and run that script.
-- OR --
You could write an expect script. To then log onto the machine, then
run a command, then run another command after that, then
so-on-and-so-forth. I like using expect personally. The expect RPM is
on one of the Mandrake CDs.
#!/usr/bin/expect
spawn telnet -l $USER $HOST
expect assword:
send $PASSWORD\r
expect $
send FIRST COMMAND
expect $
...
...
...
interact
If you close the script with interact you will now be on that remote
machine via your telnet connection and can continue to do other if
you'd like.
But those are my suggestions.
tdh
T. Holmes
-
UNIXTECHS.org
[EMAIL PROTECTED]
-
Real Men Us Vi!
| Hello!
|
| I want to write a script that makes telnet to log in and send some commands
|
| How do I do?
|
|
| //Magnus
|
--