主機間無需密碼基于ssh通信-創(chuàng)新互聯(lián)

node1:172.16.58.1

成都網(wǎng)絡(luò)公司-成都網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)公司十多年經(jīng)驗成就非凡,專業(yè)從事成都網(wǎng)站設(shè)計、成都做網(wǎng)站,成都網(wǎng)頁設(shè)計,成都網(wǎng)頁制作,軟文營銷,1元廣告等。十多年來已成功提供全面的成都網(wǎng)站建設(shè)方案,打造行業(yè)特色的成都網(wǎng)站建設(shè)案例,建站熱線:18980820575,我們期待您的來電!

node2:172.16.58.3

node1--> node2

首先在node1生成秘鑰

執(zhí)行命令ssh-keygen -P ''

詢問保存路徑直接回車默認即可,

后面提示私鑰保存為/root/.ssh/id_rsa

公鑰保存為/root/.ssh/id_rsa.pub

[root@node1 ~]# ssh-keygen -P ''

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

dc:62:ba:81:ac:dd:d9:93:fa:b4:9b:21:8d:e7:98:8c root@node1.magedu.com

The key's randomart p_w_picpath is:

+--[ RSA 2048]----+

|         |

|         |

|         |

|    . .    |

|     S .    |

|  . . = .    |

|   o = =.    |

|  o + %o+    |

|  . E OoBo    |

+-----------------+

把秘鑰傳給node2主機

ssh-copy-id -i .ssh/id_rsa.pub root@172.16.58.3

[root@node1 ~]# ssh-copy-id -i .ssh/id_rsa.pubroot@172.16.58.3

The authenticity of host '172.16.58.3 (172.16.58.3)' can'tbe established.

RSA key fingerprint isdb:f8:11:fa:7d:30:95:44:1b:eb:ea:89:ee:fa:a1:27.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '172.16.58.3' (RSA) to the listof known hosts.

root@172.16.58.3's password:

Now try logging into the machine, with "ssh'root@172.16.58.3'", and check in:

 .ssh/authorized_keys

to make sure we haven't added extra keys thatyou weren't expecting.

測試是否成功免密碼登陸,沒有提示輸入密碼

ssh 172.16.58.3 'date';date
[root@node1 ~]# ssh 172.16.58.3 'date';date

Wed Dec 31 16:51:41 CST 2014

Wed Dec 31 16:52:42 CST 2014

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

網(wǎng)頁題目:主機間無需密碼基于ssh通信-創(chuàng)新互聯(lián)
文章起源:http://muchs.cn/article48/idihp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、搜索引擎優(yōu)化、網(wǎng)站設(shè)計、品牌網(wǎng)站建設(shè)、網(wǎng)站制作、面包屑導航

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設(shè)