2009年11月12日 星期四

SCP 不用密碼的方式

Server:192.168.1.1 帳戶:hp
Client:192.168.5.5 帳戶:ibm

在192.168.1.1中:
#ssh-keygen-rsa
Enter file in which to save the key (/home/hp/.ssh/id_rsa):[Enter]
Enter passphrase (empty for no passphrase):[Enter]
Enter same passphrase again:[Enter]

產生~/.ssh/id_rsa和~/.ssh/id_rsa.pub,將id_rsa_pub裡的內容複製。

登入192.168.5.5
#vi ~/.ssh/authorized_keys2 [貼上複製內容][如裡面有東西,請插到最後面即可]
測試:
登入192.168.1.1
#scp test.txt ibm@192.168.5.5:/home/ibm/

PS:如使用ssh-keygen-dsa,從id_dsa.pub,插入authorized_keys。

沒有留言:

張貼留言