linux下 ssh 實現無需密碼的遠程登陸

主機A(OpenSUSE12.1):119.78.222.95

主機B (Fedora16): 202.122.25.36


1.主機A:生成祕鑰對id_rsa和id_rsa.pub


linux-9juc:~ # ssh-keygen -t rsa

Generating public/private rsa key pair.

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

Created directory '/root/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again: Enter

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:Enter

52:65:a0:7a:9a:42:55:a7:83:eb:d1:a0:f6:2a:e3:cf root@linux-9juc

The key's randomart image is:Enter

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

| . o.o |

| o + o |

| + + . |

| o = o |

| + + + S |

| o o = . |

| . = |

|o .o |

|.+oE |

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


2.將主機A上生成的祕鑰拷貝到主機B

linux-9juc:~/.ssh # ssh-copy-id -i id_rsa.pub [email protected]



3.重新登陸

linux-9juc:~/.ssh # ssh root@202.122.25.36

Last login: Mon Sep 16 13:18:57 2013 from 202.122.25.36

成功

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章