Re: [問題] 請問scp的使用...

看板Linux作者 (range of wavelength)時間15年前 (2009/06/05 13:52), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/4 (看更多)
※ 引述《residentevil (.....)》之銘言: : 我想要使用scp來傳輸資料給遠端的多台PC : 不過需要將傳輸動作寫在程式裡 : 也就是說是以system()來執行 : 不能像console一樣手動打入密碼 : 第一次連線的時候會出現 : The authenticity of host '172.16.0.1 (172.16.0.1)' can't be established. : RSA key fingerprint is a7:45:22:42:a5:c9:e5:31:f1:67:55:a4:a1:a5 : Are you sure you want to continue connecting (yes/no)? : 這時候需要打入"yes"也不知道該如何處理 : 請問大家知道有什麼方法可以避開這些步驟 : 或是有其他方法能夠讓scp可以用一行指令就完成? : 感謝! 1. $ssh-keygen -t rsa 建立一對代表自己身分的 public/private key 第一個問題會問 要把這些KEYS放在哪裡 Enter就好 通常會放在 ~/.ssh 下 第二第三個問題 都按 Enter 後會在 ~/.ssh 下產生兩個檔案 id_ras.pub 與 ida_rsa 前者是公鑰 後者是私鑰 然後 2. $scp ~/.ssh/id_rsa.pub remoteuser@remotehost:~/.ssh/authorized_keys2 remoteuser's password: 輸入遠端password id_rsa.pub 100% 235 816.6KB/s 00:00 (表示完成) 試著 從local 端用 ssh 登入 remotehost 看看 $ssh remoteuser@remotehost 應該就OK了 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.110.153.11 ※ 編輯: leebel 來自: 123.110.153.11 (06/05 13:55)
文章代碼(AID): #1AABAPgc (Linux)
文章代碼(AID): #1AABAPgc (Linux)