日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

使用ssh-keygen和ssh-copy-id三步实现SSH无密码登录

發布時間:2025/7/14 编程问答 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用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.
  • 注意:?ssh-copy-id?將key寫到遠程機器的 ~/?.ssh/authorized_key.文件中

    第三步:?登錄到遠程機器不用輸入密碼
  • 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
  • 上述是給eucalyptus用戶賦予無密碼登陸的權利

    [1]

  • /usr/bin/ssh-copy-id: ERROR: No identities found
  • 使用選項?-i?,當沒有值傳遞的時候或者?如果?~/.ssh/identity.pub?文件不可訪問(不存在),?ssh-copy-id?將顯示上述的錯誤信息??( -i選項會優先使用將ssh-add -L的內容)

    總結

    以上是生活随笔為你收集整理的使用ssh-keygen和ssh-copy-id三步实现SSH无密码登录的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。