加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

教你使用scp在Linux主机之间进行定时备份

发布时间:2016-11-01 02:42:02 所属栏目:Linux 来源:网络整理
导读:在两台Linux主机,而且都是ssh权限,那就建议使用scp命令备份了,这种备份速度快且是加密传输,安全性高。但是大数据的文件,不建议使用这中方法去备份! 好的,

在两台Linux主机,而且都是ssh权限,那就建议使用scp命令备份了,这种备份速度快且是加密传输,安全性高。但是大数据的文件,不建议使用这中方法去备份!

好的,实验很简单:

1 ssh传输需要密钥的 我们需要创造密钥用来验证!

ssh服务器端:

[root@text ~]# ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa): enter键

Enter passphrase (empty for no passphrase): enter键

Enter same passphrase again: enter键

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:

xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx root@text.org

[root@text ~]# cd .ssh/

[root@text .ssh]# ls

id_rsa  id_rsa.pub  known_hosts

[root@text .ssh]# scp id_rsa.pub root@192.168.0.160:/root/.ssh/authorized_keys

输入目标主机的密码 密钥传输过去了

那么下次传输文件 就不会在需要提示输入密码的!

这就为了我们crontab的写计划任务备份做了好的开头了

作者署名:51cto博客 幼兒園童鞋

查看本栏目更多精彩内容:http://www.bianceng.cn/OS/Linux/

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读