linux - SSH : Copy files without password when using public key authentication. -
we have 2 debian servers, 1 testing , 1 live. have scripts should executed transfer data live test. both servers use publickeyauthentication our id_rsa.pub's contents added authorized_keys on test server.
even after doing this, everytime initiate transfer 1 server another, being asked password.
i tried calling ssh-copy-id, didn't , got duplicate entry in authorized_keys.
lastly when try sshpass, following message, , cannot enter password message.
sshpass -v -p 'pass' ssh root@our_server sshpass searching password prompt using match "assword" sshpass read: enter passphrase key '/root/.ssh/id_rsa':
any ideas? thanks.
from output of sshpass, seams asking password of key, not password server:
enter passphrase key '/root/.ssh/id_rsa'
protecting ssh-keys password practice, can not automate things way, discovered. depending on situation, can either of following:
use ssh-agent. daemon ask password once, , keep private key cached until remove it. still has benefit ssh-key stored password-protected on disk, can use password-less key. has added benefit can forward ssh-agent on ssh: if ssh machine server a, , further on server b, last connection can use key stored on machine (instead of having copy key server a).
remove password key entirely (you can use
ssh-keygen
change password blank)
Comments
Post a Comment