On an ubuntu machine I did the following:
~$ sudo su - [sudo] password for jamie: root@mydomain:~# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 12:34:56:78:9a:bc:de:f0:12:34:56:78:9a:bc:de:f0 firstname.lastname@example.org The key's randomart image is: +--[ RSA 2048]----+ | | | | | | | | | | | | | | | | | | +-----------------+ root@mydomain:~# cat /root/.ssh/id_rsa.pub | ssh -p 443 email@example.com 'cat > ~/.ssh/authorized_keys' firstname.lastname@example.org's password: root@mydomain:~# ssh email@example.com firstname.lastname@example.org's password:
It's asking me for a password.
However, using a regular account, the following works:
$ cd ; ssh-keygen -t rsa ; cat ~/.ssh/id_rsa.pub | ssh email@example.com 'cat >> ~/.ssh/authorized_keys' $ ssh firstname.lastname@example.org Last login: Thu Oct 24 14:48:41 2013 from 18.104.22.168 [email@example.com ~]$
Which leads me to believe it's not an issue of
authorized_keys2 or permissions.
Why does the 'root' account accessing the remote 'jamie' account not work?
The remote machine is CentOS if that's relevant.