两台机器做互相信任 scp不使用密码
生活随笔
收集整理的這篇文章主要介紹了
两台机器做互相信任 scp不使用密码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
機器A和機器B之間做一個公鑰的信任,這樣就可以在下次做scp的時候不需要進行密碼驗證 可以更好的實現自動化
講一下原理:
? 假如服務器A上的一個pub(公鑰)放到了互聯網的任意一臺機器B上了,那么服務器A此時若往服務器B上傳數據或服務器A主動的想在服務器B上往自身cp數據都是需要進行驗證的。
操作步驟:使用用戶為root
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | [root@TFSns?~]#??ssh-keygen?-b?1024?-t?rsa? Generating?public/private?rsa?key?pair. Enter?file?in?which?to?save?the?key?(/root/.ssh/id_rsa):? /root/.ssh/id_rsa?already?exists. Overwrite?(y/n)??y Enter?passphrase?(empty?for?no?passphrase):? Enter?same?passphrase?again:? 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: aa:8a:3b:5b:d3:9e:6d:27:6e:1b:f5:21:46:78:b5:ec?root@TFSns The?key's?randomart?image?is: +--[?RSA?1024]----+ |??????????.??????| |???????.?o?.?????| |??????.?o?o??????| |???????o?.???????| |????????S?E??????| |???.???+?o?.?????| |??o?.?o???.??????| |.o?o?++..????????| |++..++++?????????| +-----------------+ scp?-p?.ssh/id_rsa.pub??root@192.168.1.155:/root/.ssh/authorized_keys root@192.168.1.155's?password:? id_rsa.pub????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????100%??220?????0.2KB/s???00:00 #在本機往155上主動傳輸數據: [root@TFSns?~]#?scp?test.txt?192.168.1.155:/root/ test.txt??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????100%????0?????0.0KB/s???00:00? #在本機主動的cp一個155的數據到本地 [root@TFSns?~]#?scp?192.168.1.155:/root/test.txt?./ test.txt? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
本文轉自 xinsir999 51CTO博客,原文鏈接:http://blog.51cto.com/xinsir/1783549,如需轉載請自行聯系原作者
總結
以上是生活随笔為你收集整理的两台机器做互相信任 scp不使用密码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 什么是C++
- 下一篇: loadrunner通过使用libmys