in reply to expect w/scp

It's an interesting use of Expect, but ssh can be configured to log in without the password prompt, which may be more appealing from a security standpoint because you get key-level authentication instead of a simple password.

Of course, OpenSSH and SSH act differently with regards to configuration. Look in the man page for references to "authorized_keys" for more info.

This is a little off-topic, but here is how SSH-SSH (for lack of a better term) operates.

With SSH2, on server A, you would have a file like:
~/.ssh2/identification ---------------------- IdKey id_dsa_1024_a
On server B, where you want to connect with no password:
~/.ssh2/authorization ---------------------- Key id_dsa_1024_a.pub
You would copy the "id_dsa_1024_a.pub" key from server A over to server B and put it in ~/.ssh2/

ObPerl:
Just for kicks, here's a Quick Hack that I put together to schlep keys around from one box to several others.
#!/usr/bin/perl # # ssh-addauth - Adds automatic login to a remote SSH server # from the current machine. use strict; use Sys::Hostname; my ($default_key) = "id_dsa_1024_a.pub"; # These parameters may come from: /etc/ssh2/ssh2_config my ($ssh_dir) = ".ssh2"; # UserConfigDirectory my ($ssh_authfile) = "authorization"; # AuthorizationFile my ($hostname) = hostname(); my ($username) = getpwuid($<); foreach my $arg (@ARGV) { AddAuth($arg); } sub AddAuth { my ($remote_host) = @_; system ("scp $ENV{HOME}/$ssh_dir/$default_key $remote_host:$ss +h_dir/${username}_${hostname}_dsa_1024.pub"); system ("ssh $remote_host \"echo 'Key ${username}_${hostname}_ +dsa_1024.pub' >> $ssh_dir/$ssh_authfile\""); }