I have an Ubuntu Server and OS X and Windows (Cygwin) clients.
A few days ago, I was able to successfully generate RSA keys on the client and copy them to the server with:
And I was easily able to SSH without being prompted for a password.
I created a cronjob and the OS X client would backup the Documents folder nightly and send an email with the output.
Recently, I received this in the email.
Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,password). rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-45/rsync/io.c(453) [sender=2.6.9]
When I went to manually SSH into the server, I realized that it was prompting for the password again.
I tried rebooting the server and the client, generating a new RSA key and re-sending it, changin permissions on the .ssh folder on both the server and client,
chmod 700 ~/.ssh
I tried changing permissions on the home directory of the server
chmod go-w ~
Tried to do the same procedure from a different OS X machine and had the same error of being prompted for a password after copying the SSH key to the server.
When I did a -v when doing a SSH into the server, this is what I got (hid the server IP, username, and RSA key)
Andrews-MacBook-Pro:~ USER-NAME$ ssh -v Ubuntu-User@"Server-IP" OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: Connecting to "Server-IP" ["Server-IP"] port 22. debug1: Connection established. debug1: identity file /Users/USER-NAME/.ssh/id_rsa type 1 debug1: identity file /Users/USER-NAME/.ssh/id_rsa-cert type -1 debug1: identity file /Users/USER-NAME/.ssh/id_dsa type -1 debug1: identity file /Users/USER-NAME/.ssh/id_dsa-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.2 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH* debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr firstname.lastname@example.org none debug1: kex: client->server aes128-ctr email@example.com none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA [RSA Key was Here] debug1: Host '"Server-IP"' is known and matches the RSA host key. debug1: Found key in /Users/USER-NAME/.ssh/known_hosts:3 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 debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/USER-NAME/.ssh/id_rsa debug1: Authentications that can continue: publickey,password debug1: Trying private key: /Users/USER-NAME/.ssh/id_dsa debug1: Next authentication method: password Ubuntu-User@"Server-IP"'s password:
When I enter the password, the SSH does work but I am trying to automate backups to the server at midnight and would like to not have to constantly enter the password.
What can I do to fix this?
Edit: I looked into the "/var/log/auth.log" and found that the top line might be able to help. Below that shows the line of me typing in my password and then opening up the log. Does this information help?
Mar 23 12:58:26 SERVER-USERNAME sshd: pam_ecryptfs: Passphrase file wrapped Mar 23 12:58:28 SERVER-USERNAME sshd: Accepted password for SERVER-USERNAME from "CLIENT-IP" port 55224 ssh2 Mar 23 12:58:28 SERVER-USERNAME sshd: pam_unix(sshd:session): session opened for user SERVER-USERNAME by (uid=0) Mar 23 12:58:28 SERVER-USERNAME systemd-logind: New session 10 of user SERVER-USERNAME. Mar 23 12:59:00 SERVER-USERNAME sudo: SERVER-USERNAME : TTY=pts/7 ; PWD=/home/SERVER-USERNAME ; USER=root ; COMMAND=/usr/bin/nano /var/log/auth.log Mar 23 12:59:00 SERVER-USERNAME sudo: pam_unix(sudo:session): session opened for user root by SERVER-USERNAME(uid=0)