Ubuntu – public-key for authentication

public-keysshssh-keygenssh-keysUbuntu

I have a master and slave cluster. I am setting up cloudera manager.

On the master I created a passwordless key using the following.

ssh-keygen -f id_rsa -t rsa -N '' 
eval `ssh-agent`
ssh-add ~/.ssh/id_rsa

I then placed the key on all slaves.

   cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys

From the master I can ssh without a password. It works great.

Now I need a public-key for authentication. What is the key? Is that id_rsa.pub? I have to enter into a browers the location of the public-key for auth. When I used id_rsa.pub I got this error. But using that key allows me to ssh into any other slave without a password.

No provider available for Unknown key file

You may connect via password or public-key authentication for the user selected above.


2013-01-27 03:34:49,832  INFO [1736878096@scm-web-86:node.NodeConfiguratorService@198] Retrying configurator with id 3
2013-01-27 03:34:49,834  INFO [1736878096@scm-web-86:node.NodeConfiguratorService@179] Submitted configurator for 103.4.112.102 with id 4
2013-01-27 03:34:49,836  INFO [NodeConfiguratorThread-4-4:node.NodeConfiguratorProgress@482] 103.4.112.102: Transitioning from INIT (PT0.002S) to CONNECT
2013-01-27 03:34:49,837  INFO [NodeConfiguratorThread-4-4:transport.TransportImpl@152] Client identity string: SSH-2.0-SSHJ_0_8
2013-01-27 03:34:49,844  INFO [NodeConfiguratorThread-4-4:transport.TransportImpl@161] Server identity string: SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
2013-01-27 03:34:49,844  INFO [NodeConfiguratorThread-4-4:transport.KeyExchanger@195] Sending SSH_MSG_KEXINIT
2013-01-27 03:34:49,845  INFO [reader:transport.KeyExchanger@357] Received SSH_MSG_KEXINIT
2013-01-27 03:34:49,916  INFO [reader:kex.DHG14@110] Sending SSH_MSG_KEXDH_INIT
2013-01-27 03:34:49,924  INFO [reader:transport.KeyExchanger@370] Received kex followup data
2013-01-27 03:34:49,924  INFO [reader:kex.DHG14@120] Received SSH_MSG_KEXDH_REPLY
2013-01-27 03:34:49,975  INFO [reader:transport.KeyExchanger@203] Sending SSH_MSG_NEWKEYS
2013-01-27 03:34:49,975  INFO [reader:transport.KeyExchanger@385] Received SSH_MSG_NEWKEYS
2013-01-27 03:34:49,976  INFO [NodeConfiguratorThread-4-4:node.CmfSSHClient@686] Key exchange took 0.132 seconds
2013-01-27 03:34:49,976  INFO [NodeConfiguratorThread-4-4:node.NodeConfiguratorProgress@482] 103.4.112.102: Transitioning from CONNECT (PT0.140S) to AUTHENTICATE
2013-01-27 03:34:49,977  WARN [NodeConfiguratorThread-4-4:node.NodeConfigurator@277] Could not authenticate to 103.4.xxx.xxx
net.schmizz.sshj.common.SSHException: No provider available for Unknown key file
        at net.schmizz.sshj.SSHClient.loadKeys(SSHClient.java:526)
        at com.cloudera.server.cmf.node.NodeConfigurator.connect(NodeConfigurator.java:272)
        at com.cloudera.server.cmf.node.NodeConfigurator.configure(NodeConfigurator.java:709)
        at com.cloudera.server.cmf.node.NodeConfigurator.run(NodeConfigurator.java:755)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
2013-01-27 03:34:49,977  INFO [NodeConfiguratorThread-4-4:node.NodeConfiguratorProgress@503] 103.4.112.102: Setting AUTHENTICATE as failed and done state

Best Answer

ssh public key on its own does not allow you to login to any server, it is the private & public key combination (in this case, id_rsa) which allows you to authenticate(login) into a remote server using ssh. In fact from the remote client you need to specify the private key to login to the server, not the public key.

From the Cloudera Manager installation instruction -

"For authentication during the installation and upgrade procedures, you will need to either enter the password or upload a public and private key pair for the root or sudo user account."

So if this is what you are trying to achieve, you need to upload the private key too. You will most likely find it in ~/.ssh/id_rsa