How can I get the root account to generate an acceptable ssh key?
- by Jamie
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 protected]
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| |
| |
| |
| |
| |
| |
+-----------------+
root@mydomain:~# cat /root/.ssh/id_rsa.pub | ssh -p 443 [email protected] 'cat > authorized_keys'
[email protected]'s password:
root@mydomain:~# ssh -p 443 [email protected]
[email protected]'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 protected] 'cat >> ~/.ssh/authorized_keys'
$ ssh [email protected]
Last login: Thu Oct 24 14:48:41 2013 from 173.45.232.105
[[email protected] ~]$
Which leads me to believe it's not an issue of authorized_keys versus 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.