First, install the Cwrsync
II. create a key pair to enable SSH password-free authentication
On a Linux server
[Email protected] ~]# ssh-keygen generating Public/PrivateRSA key pair. Enter fileinchWhich to save the key (/root/.ssh/Id_rsa): # # #回车Created Directory'/root/.ssh'. Enter Passphrase (Empty forno passphrase): Enter same passphrase again: # # #回车Your identification has been savedinch/root/.ssh/Id_rsa. Your PublicKey has been savedinch/root/.ssh/id_rsa.pub.The Key Fingerprint is: # # # #回车fc: the: -: the: Fd:d4:7f:3b:e7: the: the: ed:e2:c0:a9: -[email protected]the key's Randomart image is:+--[RSA2048]----+| || || || . || 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.
Is you sure 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 is already installed
/usr/bin/ssh-copy-id:info:1 key (s) remain to being installed--if you are prompted now it's to install the new keys
[email protected] ' s password:
Number of key (s) added:1
Now try logging to the machine with: "SSH" [email protected] ' "
And check to make sure that is only the key (s) wanted were added.
[[email protected] ~]# ls. ssh/
Authorized_keys Id_rsa id_rsa.pub known_hosts
########## #将id_rsa下载到本地
Iii. Editing Remote Copy Scripts
SETLOCAL Set Cwrsynchome=D:\cwRsync # # # #cwrsync安装路径 set HOME=D:\cwRsync ##### #服务器密钥rd_rsa路径 , my path is 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 is the path format, my actual path is d:/test.
######## #首次运行脚本需要手动输入一次密码 ########
Four, timed operation
- Create triggers, task execution conditions
- What to do when a condition is triggered
- If you are opening a program, run the script, select the program, script path
Windows file Backup to linux:windows Timer task +cwrsync+ssh password-free authentication