From: Schubert on
On Feb 14, 2:37 pm, "Chris F.A. Johnson" <cfajohn...(a)gmail.com> wrote:
> On 2007-02-14, Schubert wrote:
> > On Feb 14, 10:39 am, Steven Mocking
>
> >> Alice: I'm using a gun to shoot my windows open, but I seem to be
> >> shooting holes in the wall instead. I think it's broken.
> >> Bob: Use the window's handle
> >> Alice: You don't understand. How will that make my gun work?- Hide quoted text -
>
> >> - Show quoted text -
>
> > Well, Steven, I totally understand what you mean, but there will be
> > hundreds of machines that require me to do this (ssh in a server and
> > then run batch) daily. Do you still think that's an easy job if I
> > don't automate them???
>
> Of course you automate them. Just don't use expect. Use host key
> authentication and a shell script.
>
> --
> Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
> ===== My code in this post, if any, assumes the POSIX locale
> ===== and is released under the GNU General Public Licence

Thanks Chris, could you please send me the links related to use host
key authentication automation and the examples of shell script?

From: Alexander Skwar on
Schubert <cxbest2004(a)yahoo.com>:

> Well, Steven, I totally understand what you mean, but there will be
> hundreds of machines that require me to do this (ssh in a server and
> then run batch) daily. Do you still think that's an easy job if I
> don't automate them???

Who's talking about NOT automating the task? Certainly not
me.

When you run "ssh $host $command", ssh will logon to $host
and run $command on that machine. How's that NOT automated?

Alexander Skwar
From: Alexander Skwar on
Schubert <cxbest2004(a)yahoo.com>:

> On Feb 14, 2:37 pm, "Chris F.A. Johnson" <cfajohn...(a)gmail.com> wrote:
>> On 2007-02-14, Schubert wrote:
>>> On Feb 14, 10:39 am, Steven Mocking
>>
>>>> Alice: I'm using a gun to shoot my windows open, but I seem to be
>>>> shooting holes in the wall instead. I think it's broken.
>>>> Bob: Use the window's handle
>>>> Alice: You don't understand. How will that make my gun work?- Hide quoted text -
>>
>>>> - Show quoted text -
>>
>>> Well, Steven, I totally understand what you mean, but there will be
>>> hundreds of machines that require me to do this (ssh in a server and
>>> then run batch) daily. Do you still think that's an easy job if I
>>> don't automate them???
>>
>> Of course you automate them. Just don't use expect. Use host key
>> authentication and a shell script.
>>
>> --
>> Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
>> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
>> ===== My code in this post, if any, assumes the POSIX locale
>> ===== and is released under the GNU General Public Licence
>
> Thanks Chris, could you please send me the links related to use host
> key authentication automation

- Create SSH key with no password
- Copy that Key to ~/.ssh/authorized_keys (if you're using OpenSSH) on
the target machine
-> Done

> and the examples of shell script?

Your shell script is what you want to run the $host.

Example "shell script": "hostname". No, I'm not kidding.

Alexander Skwar
From: Kenny McCormack on
In article <1171703187.661874.44530(a)v45g2000cwv.googlegroups.com>,
Joe Emenaker <joe.emenaker(a)gmail.com> wrote:
>On Feb 14, 4:03 am, "Schubert" <cxbest2...(a)yahoo.com> wrote:
>>
>> > ssh $host $command
>>
>> > Ie. login to $host and then run $command. No need for expect.
>>
>> Thanks Alexander, but this is just a very small part of the entire
>> mission. Do you know what the problem is?
>
>I think Alexander's point is (and many of us were thinking the same
>thing), is why you aren't using SSH's public-key login capability...

Well, this is the nugget of every single question posted here (and,
basically, every other "support" board). Do you solve OP's problem as
posted, or do you try to reverse-engineer what he's really trying to do?

And the answer to this question boils down to:
1) It is insulting and rude to reverse-engineer.
2) It is usually "correct" to do so.

Personally, I think it is better to just take the problem as given,
assume that he has good reasons for doing it the way he is (as he says,
this is only part of a much bigger system, and I think we should take
his word for it that it can't be changed - i.e., it makes no sense to
tell him to re-engineer his whole system at this point).

Another point-of-view on this is that we all understand that, before
posting our questions to a board, we are supposed to reduce the problem
down to the barest essentials (trim away all the project-specific aspects
of it). This is all covered in the 'how to ask smart questions'
document that is frequently URL'd here. It is also common sense.
However, this has the effect that, in doing so, you make it too easy for
the "helpers" to say, "Well just do this instead", because they don't
see why you are doing it the way you are doing it (because you've elided
the details of your problem context that would allow them to see why you
are doing it the way you are doing it!)

From: Schubert on
On Feb 17, 10:20 am, gaze...(a)xmission.xmission.com (Kenny McCormack)
wrote:
> In article <1171703187.661874.44...(a)v45g2000cwv.googlegroups.com>,
>
> Joe Emenaker <joe.emena...(a)gmail.com> wrote:
> >On Feb 14, 4:03 am, "Schubert" <cxbest2...(a)yahoo.com> wrote:
>
> >> > ssh $host $command
>
> >> > Ie. login to $host and then run $command. No need for expect.
>
> >> Thanks Alexander, but this is just a very small part of the entire
> >> mission. Do you know what the problem is?
>
> >I think Alexander's point is (and many of us were thinking the same
> >thing), is why you aren't using SSH's public-key login capability...
>
> Well, this is the nugget of every single question posted here (and,
> basically, every other "support" board). Do you solve OP's problem as
> posted, or do you try to reverse-engineer what he's really trying to do?
>
> And the answer to this question boils down to:
> 1) It is insulting and rude to reverse-engineer.
> 2) It is usually "correct" to do so.
>
> Personally, I think it is better to just take the problem as given,
> assume that he has good reasons for doing it the way he is (as he says,
> this is only part of a much bigger system, and I think we should take
> his word for it that it can't be changed - i.e., it makes no sense to
> tell him to re-engineer his whole system at this point).
>
> Another point-of-view on this is that we all understand that, before
> posting our questions to a board, we are supposed to reduce the problem
> down to the barest essentials (trim away all the project-specific aspects
> of it). This is all covered in the 'how to ask smart questions'
> document that is frequently URL'd here. It is also common sense.
> However, this has the effect that, in doing so, you make it too easy for
> the "helpers" to say, "Well just do this instead", because they don't
> see why you are doing it the way you are doing it (because you've elided
> the details of your problem context that would allow them to see why you
> are doing it the way you are doing it!)

Thank you very much for you guy's reply. The point is when I logged
into the ssh server, I cannot execute unix command like "ls", "cp"
etc., so I am not able to reach the directory like /.ssh on the
server, which means I cannot do change mode. But, I can execute
command like "run", "show". I have already created the key pair, and
want to scp the public key to the ssh server, but I failed to do so.
An error message like below shows:
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY
blah, blah, blah ....

How should I do?