Re: trying to use SCP with <<EOF



On Tue, Jun 12, 2007 at 01:01:51AM -0700, fearban wrote:
Hi,

I am running an scp command from a script

scp ~/.ssh/authorized_keys user@owl:~/.ssh/authorized_keys << EOF
yes
EOF

But it is still asking me for the response.

The authenticity of host '192.168.5.28' can't be established.
RSA key fingerprint in md5 is: e6:87:00:d5:20:35:51:4e:97:9a:62:41:cd:
46:4c:30
Are you sure you want to continue connecting(yes/no)?

Can anyone help

I'm not really sure how to help you with the "<< EOF" things.. But
it will ask you this only once, so if you login once with password
authentification before copying your key, you will never see this
message again. And are you going to use this "<< EOF" method for the
password ? I don't think that doing this in a fully automated script is
very usefull.. Since you will have to copy your key only once.. so a
little interaction is not that annoying in that case. You can just don't
use the "<< EOF" and let the user to type the "yes"...

BTW, because you will not be able to add extra keys to the same
"authorized_keys" file if you use /scp/. You may want to do something like
this instead:

cat ~/.ssh/authorized_keys | ssh user@owl "test -d .ssh || \
mkdir .ssh; cat - >> .ssh/authorized_keys"

that way.. you will add a key if "authorized_keys" already exist.

--
Martin
.



Relevant Pages