Ubuntu

ubuntu - 用於身份驗證的公鑰

  • January 27, 2013

我有一個主從集群。我正在設置 cloudera 管理器。

在主伺服器上,我使用以下內容創建了一個無密碼密鑰。

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

然後我把鑰匙放在所有的奴隸身上。

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

從主人那裡我可以在沒有密碼的情況下ssh。它工作得很好。

現在我需要一個公鑰來進行身份驗證。關鍵是什麼?那是 id_rsa.pub 嗎?我必須在瀏覽器中輸入身份驗證公鑰的位置。當我使用 id_rsa.pub 時,我得到了這個錯誤。但是使用該密鑰可以讓我在沒有密碼的情況下通過 ssh 連接到任何其他從站。

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

ssh 公鑰本身不允許您登錄到任何伺服器,它是私鑰和公鑰組合(在本例中為 id_rsa),它允許您使用 ssh 驗證(登錄)到遠端伺服器。實際上,您需要從遠端客戶端指定私鑰才能登錄伺服器,而不是公鑰。

從 Cloudera Manager 安裝說明 -

“對於安裝和升級過程中的身份驗證,您需要輸入密碼或上傳 root 或 sudo 使用者帳戶的公鑰和私鑰對。”

因此,如果這是您想要實現的目標,您也需要上傳私鑰。您很可能會在 ~/.ssh/id_rsa 中找到它

引用自:https://serverfault.com/questions/472750