基于cron、rsync和ssh免密码登录实现Linux系统间自动同步~

1.设置ssh免密码登录,配置详解:http://blog.lizhigang.net/archives/249

注:如果设置完用ssh登录还需密码则通过查看/var/log/secure的ssh登录日志,如果报错:Authentication refused: bad ownership or modes for directory

,则是.ssh上层目录的权限没设置好,上层目录权限应需设置为:750或700

 

2.设置cron每隔多久执行指令:rsync -avz –delete /home/sc/file root@192.168.8.122:/home/sc/file/         #这条仅同步本地sc/file/目录和远程122主机的目录进行同步,具体rsync指令根据环境来写。

 

另外附两篇本人感觉写的比较好的 SSH相关公钥、私钥加密文章:

  http://my.oschina.net/zhlmmc/blog/42111

  http://www.ruanyifeng.com/blog/2011/08/what_is_a_digital_signature.html

posted @ 2013-02-21 16:46  Samurail  阅读(744)  评论(0编辑  收藏  举报