第一步:生成密匙对,我用的是rsa的密钥。使用命令 "ssh-keygen -t rsa"
ssh-keygen -t rsa
然后敲三个回车
#其中公共密钥保存在 ~/.ssh/id_rsa.pub
#私有密钥保存在 ~/.ssh/id_rsa
然后改一下 .ssh 目录的权限,使用命令 "chmod 755 ~/.ssh"
之后把这个密钥对中的公共密钥复制到你要访问的机器上去,并保存为~/.ssh/authorized_keys
有多台服务器的话可以再authorized_keys中添加信息
crontab -e 中添加
30 9 * * 1 scp /backup/aaa.log root@192.168.1.130:/usr/mainwebdb
/etc/init.d/crond restart