if created a keyfile for my user to sync two linux server via a cronjob and rsync but right now I've got a problem.
I'm using a keyfile but i don't get no errors on connect but its still prompting me for the password.
My command is: rsync -aun -e "ssh -i /kunden/343193_51373/.ssh/authorized_keys/id_rsa.pub" user@host:/kunden/343194_51373/webseiten /kunden/343193_51373/webseiten
i hope you know the problem and got a solution for this without the need of root rights 🙂
greetings,
Frederick
EDIT:
SHH -v Log:
ssh -v -i /kunden/343193_51373/.ssh/identity -l user host
OpenSSH_5.8p1-hpn13v10, OpenSSL 1.0.0e 6 Sep 2011
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to xxxxxxxx [xxxxxxxx] port 22.
debug1: Connection established.
debug1: identity file /kunden/343193_51373/.ssh/identity type 0
debug1: identity file /kunden/343193_51373/.ssh/identity-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1-hpn13v10
debug1: match: OpenSSH_5.8p1-hpn13v10 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8p1-hpn13v10
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: AUTH STATE IS 0
debug1: REQUESTED ENC.NAME is 'aes128-ctr'
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: REQUESTED ENC.NAME is 'aes128-ctr'
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 22:72:XXXXXXXXXXXXX:84:5f:d4:5b:11:0d
debug1: Host 'xxxxxxxxxx' is known and matches the RSA host key.
debug1: Found key in /kunden/343193_51373/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Next authentication method: keyboard-interactive
Best Answer
ssh -i /path/to/private/key
is the correct syntax. You are using you're public key... this will not work!Appart from that. Are you sure you're setup is correct... I'm not aware that authorized_keys can be a folder! See http://sshkeychain.sourceforge.net/mirrors/SSH-with-Keys-HOWTO/SSH-with-Keys-HOWTO-4.html for a complete tutorial. Or if you prefer one in German http://www.huschi.net/14_141_de-howto-secure-shell-ssh-public-key-authentication.html
Also check you're key permissions. private key should have
600
. Same applies for the authorized_keys file.To debug, you should start of with plain ssh... you might need to add an user to the ssh command.
edit:
how have you created your ssh keys? open them with a texteditor and verify they look correct. A private key should start with:
a public key looks like:
verify authorized_keys on the server contains the public key in one line.