在两台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的写计划任务备份做了好的开头了