標籤: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免密碼認證