使用ssh-keygen和ssh-copy-id三步实现SSH无密码登录
生活随笔
收集整理的這篇文章主要介紹了
使用ssh-keygen和ssh-copy-id三步实现SSH无密码登录
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
ssh-keygen? 產生公鑰與私鑰對.
ssh-copy-id?將本機的公鑰復制到遠程機器的authorized_keys文件中,ssh-copy-id也能讓你有到遠程機器的home, ~./ssh , 和 ~/.ssh/authorized_keys的權利
第一步:在本地機器上使用ssh-keygen產生公鑰私鑰對 jsmith@local-host$ [Note: You are on local-host here] jsmith@local-host$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key] Enter passphrase (empty for no passphrase): [Press enter key] Enter same passphrase again: [Pess enter key] Your identification has been saved in /home/jsmith/.ssh/id_rsa. Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub. The key fingerprint is: 33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9?jsmith@local-host 第二步:用ssh-copy-id將公鑰復制到遠程機器中 jsmith@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host jsmith@remote-host's password: Now try logging into the machine, with "ssh 'remote-host'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. jsmith@local-host$ ssh remote-host Last login: Sun Nov 16 17:22:33 2008 from 192.168.1.2 [Note: SSH did not ask for password.] jsmith@remote-host$ [Note: You are on remote-host here] ssh-copy-id -u eucalyptus -i ~eucalyptus/.ssh/id_rsa.pub?eucalyptus@remote_host /usr/bin/ssh-copy-id: ERROR: No identities found
第一步:在本地機器上使用ssh-keygen產生公鑰私鑰對
注意:?ssh-copy-id?將key寫到遠程機器的 ~/?.ssh/authorized_key.文件中
第三步:?登錄到遠程機器不用輸入密碼?
常見問題:
上述是給eucalyptus用戶賦予無密碼登陸的權利
[1]
使用選項?-i?,當沒有值傳遞的時候或者?如果?~/.ssh/identity.pub?文件不可訪問(不存在),?ssh-copy-id?將顯示上述的錯誤信息??( -i選項會優先使用將ssh-add -L的內容)
總結
以上是生活随笔為你收集整理的使用ssh-keygen和ssh-copy-id三步实现SSH无密码登录的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HDFS 的Trash回收站功能的配置、
- 下一篇: hadoop 配置项的调优