Linux下使用crontab调用shell中的scp自动备份mysql数据


一、为了在Linux下使用scp的时候不需要输入密码,采用ssh另一种用密钥对来验证的方式 。

1、使用ssh-keygen 命令生成密钥。生成过程中,除了输入密码外,其他都选择默认的值:回车即可。

[root@xxx root]# ssh-keygen -t rsa

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:

e0:f0:3b:d3:0a:3d:da:42:01:6a:61:2f:6c:a0:c6:e7 root@xxx

[root@xxx root]#

  • 1
  • 2
  • 下一页

相关内容