From: John Kelly on
On Fri, 18 Jun 2010 08:10:53 -0700 (PDT), Stu <beefstu350(a)hotmail.com>
wrote:

>I get the following message:
>
>Connecting to diamond...
>The authenticity of host 'diamond (172.16.2.14)' can't be established.
>RSA key fingerprint is 35:cd:be:e4:8a:27:4e:fe:9b:c3:87:89:eb:
>52:dc:a7.
>Are you sure you want to continue connecting (yes/no)? no
>Host key verification failed.

>Can somebody tell me how to rectify this problem so I dont get
>prompted in my script and it will work for from multiple source machines.

Answer yes to the question.

That creates entries in ~/.ssh/known_hosts for the target, and you won't
be prompted again. Copy those entries to ~/.ssh/known_hosts on all
source machines.

Or delete ~/.ssh/known_hosts, and when you answer the question, it will
be re-created, with entries only for the target. Then you can copy the
new ~/.ssh/known_hosts file to all source machines.


--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php

From: pk on
Stu wrote:

> Thanks all great solutions. I just need to know why I am being asked
> for a password in my
> script. Is there anyway to avoid that?
>
> Connecting to diamond...
> The authenticity of host 'diamond (172.16.2.14)' can't be established.
> RSA key fingerprint is 35:cd:be:e4:8a:27:4e:fe:9b:c3:87:89:eb:
> 52:dc:a7.
> Are you sure you want to continue connecting (yes/no)? y
> Please type 'yes' or 'no': yes
> Warning: Permanently added 'diamond,172.16.2.14' (RSA) to the list of
> known hosts.
> phartman(a)diamond's password:

This is a different, albeit related, matter. To be able to login without
being asked for a password, you need to use public key authentication.

First of all, the ssh server on the target machine must support it (I can't
think of a reason why it shouldn't though). Then, you need to have a keypair
(a private key and its corresponding public key) on the machine you're
connecting from; these are usually found under ~/.ssh (where ~ is the home
directory of the user who needs to connect).
Of these two keys, you need to get the data contained in the *public* key
file into the file ~/.ssh/authorized_keys on the remote machine (~ is the
home directory of the user you will connect as on the remote box).

Once you've done that, you should be able to connect without being asked for
a password.
Ah no, there's a final matter: to be completely passwordless, the *private*
key file on the local machine must not be password protected (the password
is usually set when the heypair is generated).
From: Maxwell Lol on
Stu <beefstu350(a)hotmail.com> writes:

> Thanks all great solutions. I just need to know why I am being asked
> for a password in my
> script. Is there anyway to avoid that?

I don't think you are reading the responses.

It's NOT a password.

sftp is asking if the host is the proper device, or an impostor.

Solution:

Run sftp once on the command line, and without your script.

When it asks you if you are talking to the right host, say
yes.


From then on your script will work.
From: pk on
Maxwell Lol wrote:

> Stu <beefstu350(a)hotmail.com> writes:
>
>> Thanks all great solutions. I just need to know why I am being asked
>> for a password in my
>> script. Is there anyway to avoid that?
>
> I don't think you are reading the responses.
>
> It's NOT a password.

er:

Connecting to diamond...
The authenticity of host 'diamond (172.16.2.14)' can't be established.
RSA key fingerprint is 35:cd:be:e4:8a:27:4e:fe:9b:c3:87:89:eb:
52:dc:a7.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'diamond,172.16.2.14' (RSA) to the list of
known hosts.
phartman(a)diamond's password:

From: Bill Marcum on
On 2010-06-19, pk <pk(a)pk.invalid> wrote:
> Maxwell Lol wrote:
>
>> Stu <beefstu350(a)hotmail.com> writes:
>>
>>> Thanks all great solutions. I just need to know why I am being asked
>>> for a password in my
>>> script. Is there anyway to avoid that?
>>
>> I don't think you are reading the responses.
>>
>> It's NOT a password.
>
> er:
>
> Connecting to diamond...
> The authenticity of host 'diamond (172.16.2.14)' can't be established.
> RSA key fingerprint is 35:cd:be:e4:8a:27:4e:fe:9b:c3:87:89:eb:
> 52:dc:a7.
> Are you sure you want to continue connecting (yes/no)? y
> Please type 'yes' or 'no': yes
> Warning: Permanently added 'diamond,172.16.2.14' (RSA) to the list of
> known hosts.
> phartman(a)diamond's password:
>
Try the command "ssh-copy-id". And if your user names are different on
the local and remote hosts, you can add an entry to the local ~/.ssh/config.


--
[It is] best to confuse only one issue at a time.
-- K&R