您的位置:首页 > 运维架构 > Linux

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

2012-03-06 09:33 288 查看
在两台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的写计划任务备份做了好的开头了

本文出自 “幼兒園童鞋” 博客,请务必保留此出处http://yangxiaofei.blog.51cto.com/2910082/797764
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: