Backup with rsync + SSH?

Discussion in 'Server Operation' started by stormrider, Oct 23, 2007.

  1. stormrider

    stormrider New Member

    Hello,

    I'm currently backing up a server with rsync. I guess the default is to use rsh but i have read some stuff about it and it isn't secure ( right? ).

    So i would like to use SSH but how can i do this without actually give an account to the user on the system?

    I want something secure that only gives the user privileges to backup using rsync. Nothing more than this.
     
  2. falko

    falko Super Moderator Howtoforge Staff

  3. lwh.dk

    lwh.dk New Member

    File backup using Cron ?

    What do you like to backup ?
    Files, DB, mail ????

    This is a sample on at script I'm currently is using to sync my two production servers backup filedirs once a week.
    To make this script work you need to exchange ssh key's between the local user that's runnes the rsync backup script and the remote user that is used to auth the SSH connection with the rsync is using to secure the file copy.

    #!/bin/sh
    RSYNC=/usr/bin/rsync
    SSH=/usr/bin/ssh
    RemoteUSER=remotebackupuser
    RemoteHOST=RemoteServerName
    RemotePATH=/data/backup/MainServer
    LocalPATH=/data/backup/

    echo Running this command
    echo $RSYNC -az -e ssh $LocalPATH$RemoteUSER@$RemoteHOST:$RemotePATH

    $RSYNC -az -e ssh $LocalPATH$RemoteUSER@$RemoteHOST:$RemotePATH


    Quit simple... after 5 hours with master GOOGle
     

Share This Page