I've been struggling with this for a couple hours so any help is greatly appreciated...
I have 2x servers both of which I can ssh
to with public keys from OSX, no issues at all there so I'm certain everything is good with sshd_config
.
I'm trying to configure a cron job for rsync
to sync the two servers and need server B (backup) to ssh
into server A using a public key.
I cannot for the life of me work out why it doesn't find my public keys - they are in ~/.ssh/
(ie. /root/.ssh
) and all file permissions are correct on A & B.
This is the output:
debug2: we did not send a packet, disable method
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug3: no such identity: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug3: no such identity: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug3: no such identity: /root/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
Also note it is looking for private keys which don't exist...
drwx------. 2 root root 4096 May 25 10:15 .
dr-xr-x---. 4 root root 4096 May 24 18:52 ..
-rw-------. 1 root root 403 May 25 01:37 authorized_keys
-rw-------. 1 root root 0 May 25 01:41 config
-rw-------. 1 root root 1675 May 25 02:35 id_rsa_tm1
-rw-------. 1 root root 405 May 25 02:35 id_rsa_tm1.pub
-rw-------. 1 root root 395 May 25 02:36 known_hosts
ls -la /root/.ssh/
_tm1
from your key file names (i.e.mv id_rsa_tm1 id_rsa
andmv id_rsa_tm1.pub id_rsa.pub
)ssh-add /root/.ssh/id_rsa_tm1
, then the key is stored in the keychain persistently and SSH can find it from there. This is a Mac-specific extension: a generic OpenSSH client won't have such functionality, and to use non-default keys you would either have to use an option likessh -i ~/.ssh/id_rsa_tm1 ...
, or use the~/.ssh/config
file to specify which non-default key to use with a specific server.