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 email@example.com The key's randomart image is: +--[ RSA 2048]----+ | | | | | | | | | | | | | | | | | | +-----------------+ root@mydomain:~# cat /root/.ssh/id_rsa.pub | ssh -p 443 firstname.lastname@example.org 'cat > ~/.ssh/authorized_keys' email@example.com's password: root@mydomain:~# ssh firstname.lastname@example.org email@example.com'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 firstname.lastname@example.org 'cat >> ~/.ssh/authorized_keys' $ ssh email@example.com Last login: Thu Oct 24 14:48:41 2013 from 126.96.36.199 [firstname.lastname@example.org ~]$
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.