先在 from 那台機器中下:

ssh-keygen -t rsa

他會問你三個問題

  1. Enter file in which to save the key (/home/from/.ssh/id_rsa):就按Enter吧!
  2. Enter passphrase (empty for no passphrase):就直接按Enter
  3. Enter same passphrase again:一樣按Enter

他會跟你說你的檔案放在哪裡,通常是放在 ~/.ssh/id_rsa.pub

把id_rsa.pub的內容複製起來

進 to@10.1.198.222

然後把文字插入到 to@10.1.198.222的 ~/.ssh/authorized_keys2

如果裡面已經有東西的話,不用刪,插到最後面就可以了

-------------------------------

如果你用 ssh-keygen -t dsa (原本是dsa)

則是把~/.ssh/id_dsa.pub的key

插入到 to的 ~/.ssh/authorized_keys

如果目标机发生改变,无法建立链接,怎么办?

删除 /root/.ssh/known_hosts  后,重新连接就可以了

相关文章:

  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
猜你喜欢
  • 2022-02-02
  • 2022-01-17
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
相关资源
相似解决方案