windows檔案備份到linux:windows定時任務+cwrsync+ssh免密碼認證

來源:互聯網
上載者:User

標籤:cti   empty   div   check   for   main   code   host   alt   

一、安裝cwrsync

二、建立金鑰組,實現ssh免密碼驗證

linux伺服器上

[[email protected] ~]# ssh-keygen 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:         ###斷行符號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:      ####斷行符號fc:68:38:67:fd:d4:7f:3b:e7:67:93:ed:e2:c0:a9:25 [email protected]The key‘s randomart image is:+--[ RSA 2048]----+|                 ||                 ||                 ||       .         ||        S        ||       . + . o   ||      o = E * . o||       =   * ..=*||          . ...*@|+-----------------+

[[email protected] ~]# ssh-copy-id [email protected]
The authenticity of host ‘localhost (::1)‘ can‘t be established.
ECDSA key fingerprint is e5:07:2a:f0:9f:c5:df:64:70:61:6a:7a:31:bf:21:7a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]‘s password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh ‘[email protected]‘"
and check to make sure that only the key(s) you wanted were added.

[[email protected] ~]# ls .ssh/
authorized_keys  id_rsa  id_rsa.pub  known_hosts
###########將id_rsa下載到本地

三、編輯遠程copy指令碼

 SETLOCAL SET CWRSYNCHOME=D:\cwRsync    ####cwrsync安裝路徑 SET HOME=D:\cwRsync      ######伺服器密鑰rd_rsa路徑,我的路徑為D:\cwRsync\.ssh SET CWOLDPATH=%PATH% SET PATH=%CWRSYNCHOME%\BIN;%PATH%
cd D:\cwRsync\bin
rsync -avz --delete /cygdrive/d/test [email protected]:/tmp ######/cygdrive是路徑格式,我的實際路徑為d:/test。
#########首次運行指令碼需要手動輸入一次密碼########

四、定時運行

  • 建立基本任務

  • 建立觸發器,任務執行條件

 

 

  • 具體執行時間

  •  觸發條件後需要做哪些操作

 

  • 如果是開啟程式,運行指令碼,請選擇程式、指令碼路徑

 

windows檔案備份到linux:windows定時任務+cwrsync+ssh免密碼認證

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.