I need to do rsync
by ssh
and want to do it automatically without the need of passing password for ssh
manually.
You should use a keyfile without passphrase for scripted ssh logins. This is obviously a security risk, take care that the keyfile itself is adequately secured.
From Instructions for setting up passwordless ssh access:
Run ssh-keygen
It will ask for a path to the key file, a passphrase, and a repeat of the same passphrase. Answer all three by just pressing Enter
(accepting the defaults).
Run ssh-copy-id -i ~/.ssh/id_rsa.pub <remote-host>
The path ~/.ssh/id_rsa.pub
to the public key file may be different if you chose another path in step 1. Replace <remote-host>
with the IP or hostname of the remote host you want to log in to.
Run ssh <remote-host>
The remote host should not ask for a password, and you should be logged in to the remote host.