[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scp guide



Hi,
michael crane wrote,

> hello,
> Could somebody be so kind to explain to me an idiot's guide to copying 
> files via scp without the need for a password so the scp instruction can 
> be put into a cron job ?

Simply generate a ssh key on the client system as the user the
cronscript will be running. 
ssh-keygen -t rsa (use no passphrase, double enter)
Then copy the ~/.ssh/id_rsa.pub over to the server machine into the
file ~/.ssh/authorized_keys of the user you want to connect as.
cat ~/.ssh/id_rsa.pub | ssh user_(_at_)_server 'cat >> .ssh/authorized_keys'

After that you should successfully login into the server machine
without a password. If this does not work, you should use ssh -vv
to see what happens. If the permissions of the homedirectory and/or
.ssh-directory are wrong, authorization could fail.

> So far I have tried.
> Added same users on each machine
> typed "ssh_keygen -t rsa" as that user on each machine.
> connected from each machine to other via ssh ( typing password ) which 
> makes ~/.ssh/known_hosts
> copied from machineA ~/.ssh/id_rsa.pub to machineB ~/.ssh/authorised_keys
> copied from machineB ~/.ssh/id_rsa.pub to machineA ~/.ssh/authorised_keys
                                                        ^^^^^^^^^^^^^^^^^^

The name is authorized_keys! Check the spelling.

> added "machineA_ipaddress username" to machineB/etc/hosts.equiv
> added "machineB_ipaddress username" to machineA/etc/hosts.equiv

Not needed.
 
bye
    Waldemar

-- 
CE94 5F99 BA88 65B1 25B9  8CD1 305A FF6B F8F8 1846
gpg --keyserver x-hkp://pgp.mit.edu --recv-keys F8F81846

*** http://www.openbsd.de/~wbx ***



Visit your host, monkey.org