windows文件备份到linux:windows定时任务+cwrsync+ssh免密码认证
2024-09-07 16:32:09
一、安装cwrsync
二、创建密钥对,实现ssh免密码验证
linux服务器上
[root@zabbix ~]# 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::::fd:d4:7f:3b:e7:::ed:e2:c0:a9: root@zabbix.suffergtf.com The key's randomart image is: +--[ RSA ]----+ | | | | | | | . | | S | | . + . o | | o = E * . o| | = * ..=*| | . ...*@| +-----------------+ [root@zabbix ~]# ssh-copy-id root@localhostThe 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 keysroot@localhost's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@localhost'"and check to make sure that only the key(s) you wanted were added. [root@zabbix ~]# 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 root@192.168.127.250:/tmp ######/cygdrive是路径格式,我的实际路径为d:/test。#########首次运行脚本需要手动输入一次密码########
四、定时运行
- 创建基本任务
- 创建触发器,任务执行条件
- 具体执行时间
- 触发条件后需要做哪些操作
- 如果是打开程序,运行脚本,请选择程序、脚本路径
最新文章
- 《MSSQL2008技术内幕:T-SQL语言基础》读书笔记(下)
- C# 条件编译
- Perl技巧
- [刘阳Java]_MyBatis_映射文件的select标签入门_第3讲
- iOS常用第三方库
- 如何卸除SDL TRADOS中的自开发插件
- Oracle Essbase入门系列(二)
- GitHub入门之一:使用github下载项目
- VS自带WCF测试客户端简单介绍
- Java 线程池框架核心代码分析
- Luence简单实现1
- eclipse实现JavaWeb应用增量打包
- find+*的问题
- [转]【基于zxing的编解码实战】精简Barcode Scanner篇
- (Problem 42)Coded triangle numbers
- PHP连接和拆分数组array_combine()和array_slice()用法示例
- PhantomJS 与python的结合
- ajax请求后台,有时收不到返回值的解决办法
- python全栈开发-Day10 装饰器(闭合函数的应用场)
- iview 菜单数据的转换,动态加载
热门文章
- bzoj 3676: [Apio2014]回文串【回文自动机】
- 【CodeForces - 501B 】Misha and Changing Handles(map)
- 关于Page翻页效果, PageViewConrtoller
- Luogu P4889 kls与flag 【思维/排序】By cellur925
- IO流案例:1.复制多级文件夹 2.删除多级文件夹
- @ConfigurationProperties和@EnableConfigurationProperties配合使用
- FlashFXP Registration
- POM报错Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from
- archsummit_bj2014
- iOS infoq资料架构设计漫谈