成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

如何實現(xiàn)Linux主機遠程登錄ssh免密碼

系統(tǒng) Linux 系統(tǒng)運維
本文作者公司剛上幾臺Linux,現(xiàn)在要把主機之間實現(xiàn)都能遠程ssh免密碼登陸。方法很簡單,使用ssh-keygen在主機A上生成private和public密鑰,將生成的public密鑰拷貝到遠程機器主機B上后,就可以使用ssh命令無需密碼登錄到另外一臺機器主機B上。

  [[152756]]

【引自xxxx的博客】一、情景

  公司剛上幾臺Linux,現(xiàn)在要把主機之間實現(xiàn)都能遠程ssh免密碼登陸。

  二、原理

  很簡單,使用ssh-keygen在主機A上生成private和public密鑰,將生成的public密鑰拷貝到遠程機器主機B上后,就可以使用ssh命令無需密碼登錄到另外一臺機器主機B上。

  三、步驟

  主機A:

  1.生成公鑰和私鑰文件id_rsa和id_rsa.pub (敲三下回車即可)。

 

  1. [root@bogon ~]# ssh-keygen -t rsa  
  2. Generating public/private rsa key pair.  
  3. Enter file in which to save the key (/root/.ssh/id_rsa):  
  4. Enter passphrase (empty for no passphrase):  
  5. Enter same passphrase again:  
  6. Your identification has been saved in /root/.ssh/id_rsa.  
  7. Your public key has been saved in /root/.ssh/id_rsa.pub.  
  8. The key fingerprint is 
  9. 67:da:0d:79:e0:d6:2b:cd:7d:22:af:51:7e:9c:75:fe root@bogon  
  10. The key's randomart image is 
  11. +--[ RSA 2048]----+  
  12. | |  
  13. | |  
  14. | . |  
  15. | . + |  
  16. | S B o . o|  
  17. | * * = o+|  
  18. | . o B +.=|  
  19. | . + +.|  
  20. | ... E|  
  21. +-----------------+ 

  2.ssh-cop-id命令會將指定的公鑰文件復(fù)制到遠程計算機。

 

  1. [root@bogon ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@10.1.250.166  
  2. The authenticity of host '10.1.250.166 (10.1.250.166)' can't be established.  
  3. RSA key fingerprint is c8:9d:6d:92:55:77:3d:3e:af:f5:cb:18:80:5a:47:93.  
  4. Are you sure you want to continue connecting (yes/no)? yes  
  5. Warning: Permanently added '10.1.250.166' (RSA) to the list of known hosts.  
  6. reverse mapping checking getaddrinfo for bogon [10.1.250.166] failed - POSSIBLE BREAK-IN ATTEMPT!  
  7. root@10.1.250.166's password: <主機B的登陸密碼> 
  8. Now try logging into the machine, with "ssh 'root@10.1.250.166'"and check in 
  9. .ssh/authorized_keys  
  10. to make sure we haven't added extra keys that you weren't expecting. 

  3.然后ssh登陸主機B驗證是否需要密碼。

 

  1. [root@localhost ~]# ssh 10.1.250.166  
  2. reverse mapping checking getaddrinfo for bogon [10.1.250.166] failed - POSSIBLE BREAK-IN ATTEMPT!  
  3. Last login: Wed Oct 21 10:05:39 2015 from 10.1.250.141  
  4. [root@bogon ~]# 

  4.登陸成功后,我們需要在主機B也做下以上3步,這樣就可以相互免密碼ssh登陸。(如果有多臺主機,每臺主機都做下相同操作,以方便以后管理)。

  5.權(quán)限問題

  建議用其他用戶做ssh登陸的話,調(diào)整目錄文件權(quán)限。

  設(shè)置authorized_keys權(quán)限  

  1. chmod 644 authorized_keys 

  設(shè)置.ssh目錄權(quán)限  

  1. chmod 700 -R .ssh 

  6.要保證.ssh和authorized_keys都只有用戶自己有寫權(quán)限。否則驗證無效。

  本文出自 “好大的刀” 博客,請務(wù)必保留此出處:http://53cto.blog.51cto.com/9899631/1704792

責(zé)任編輯:火鳳凰 來源: 51CTO博客
相關(guān)推薦

2023-09-13 22:54:06

2016-01-25 13:03:21

2009-08-17 08:22:53

linuxssh遠程登錄

2012-09-28 10:12:55

2015-05-28 15:32:14

Linuxssh

2024-10-28 09:38:15

2013-05-28 13:51:57

LinuxCentos

2024-06-20 12:35:36

2018-07-03 10:33:51

服務(wù)器運維Linux

2013-04-09 15:06:23

2018-03-09 09:45:52

LinuxSSH登錄導(dǎo)語

2010-05-06 09:51:15

SCO Unix主機

2013-08-15 16:24:13

2017-06-22 08:58:51

Hadoopssh+IPssh+

2023-02-21 10:07:23

2019-10-23 04:37:56

Jschsftp服務(wù)器

2015-04-09 09:08:20

2020-09-10 11:00:20

SSH遠程Linux

2020-09-03 10:45:46

SSHLinux遠程

2017-03-16 14:07:11

LinuxSSH遠程訪問
點贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 免费在线看a | 日韩精品一区在线 | 欧美多人在线 | 黄色成人免费在线观看 | 99成人免费视频 | 搞黄视频免费看 | 夜夜骑综合 | 欧美一二三 | 久草网址| 亚洲欧美激情精品一区二区 | 热久久性| 污视频在线免费观看 | 国产区高清 | 亚洲二区视频 | 午夜在线 | 看片国产 | 国产成人精品一区二区 | 欧美在线视频一区二区 | 国产一级成人 | 久草视频观看 | 成人网在线 | 福利电影在线 | 欧美精品在线播放 | 国产精品二区三区 | 毛片一区二区三区 | 国产精品影视在线观看 | 二区欧美 | 久久久一二三 | 久久99精品久久久久久 | 亚洲日日 | 天天噜天天干 | 国产精品一区二区三区在线 | 国产免费高清 | 国产精品综合色区在线观看 | 久久久久se| 中文字幕日韩一区二区 | 日韩在线视频免费观看 | 欧美狠狠操| 国产精品99久久久久久www | 97精品国产97久久久久久免费 | 国产成人精品网站 |