配置多台centos 機器 免密登入:用於搭建集群,redis,storm...
現在有4臺機器 主機名分別是 eshop-cache01 eshop-cache02 eshop-cache03 eshop-cache04
1、首先在eshop-cache02 ,eshop-cache03 eshop-cache04 三颱機器上配置對本機的ssh免密碼登入 (每台機器上都執行下面的命令)
生成本機的公鑰,過程中不斷敲回車即可,
ssh-keygen命令缺省會將公鑰放在/root/.ssh目錄下
ssh-keygen -t rsa
將公鑰複製為authorized_keys檔案,此時使用ssh連線本機就不需要輸入密碼了
cd /root/.ssh
cpid_rsa.pub authorized_keys 2
、把各個機器的公鑰彙總到一台機器上(每台機器上都執行下面的命令)
先將每一台機器的公鑰複製到其中某一台機器中,即讓某一台機器可以訪問所有機器。
使用ssh-copy-id -i hostname命令將本機的公鑰拷貝到指定機器的 authorized_keys 檔案中,每台機器上都執行這個命令。
比如: 將所有的公鑰都集中到 eshop-cache01 這台機器上。
在02 03 04 上敲命令:
ssh-copy-id -i eshop-cache01 3
、將這 01 臺機器的 authorized_keys 檔案複製到其他所有機器
scp /root/.ssh/authorized_keys eshop-cache02:/root/.ssh
02,03 也是一樣的操作....
複製完後,再用ssh每台機器都相互登入一下,主要是為了敲一下這個 yes。
the authenticity of host
'eshop-cache02 (192.168.1.162)
' can'
t be established.
rsa key fingerprint is 11:02:69:08:e2:10:b2:e2:db:c5:34:d4:4d:18
:a7:4a.
are you sure you want to continue connecting (yes/no)?yes
測試命令為:
在02 03 04 上 敲 : ssh eshop-cache01
退出 eshop=cache01: exit
centos7ssh免密登入
在a上生成公鑰私鑰。將公鑰拷貝給server b,要重新命名成authorized keys 從英文名就知道含義了 將公鑰拷貝給server b,要重新命名成authorized keys 從英文名就知道含義了 server a向server b傳送乙個連線請求。server a向server b傳...
centos7 ssh免密登陸設定
1 使用root使用者登入,進入到目錄 root ssh 2 執行命令 ssh keygen t rsa 一路回車,完成後會在目錄 root ssh下面生成檔案 id rsa和id rsa.pub 3 將公鑰寫入檔案authorized keys cat id rsa.pub authorized ...
centos7 實現ssh免密登入
1 三颱虛擬機器關閉防火牆 systemctl stop firework setenforce 0 10.254.50.30 test0 10.254.50.31 test1 10.254.50.32 test2 2 vim etc hosts 追加所有ip和網域名稱 10.254.50.30 t...