Il y a 389 articles et 19 utilisateurs inscrits (ce bandeau est défini dans MediaWiki:Sitenotice)

Rsync windows vers linux

De AJLSM
Aller à la navigation Aller à la recherche
Notice :
Ce tuto est copié de la page http://www.evbackup.com/support-grsync-windows/ . On utilisera l'utilitaire grsync. Les fichiers sources à sauvegarder se trouvent sur la machine Windows. Le dossier de destination se trouvent sur la machine Linux..

Grsync for Windows

Grsync is a visual tool to help you configure rsync. It is available for Windows, Mac, and Linux, takes minutes to configure, and automation is a snap.

Grsync can be used configure different backup sessions so that different backup jobs can be run on different schedules. Grsync can also utilize SSH keys for password-free authentication. Everything you need to get going is included in one download. With Grsync, your backups will be worry-free in no time at all!

Installation on Microsoft Windows

Installation of Grsync is a snap:

  1. Download Grsync for Windows.
  2. Double-click the self-extracting zip file to install. Accept the default installation options.

Generating an SSH Keypair with ssh-keygen

  1. Open the Run prompt by holding down the Window key on your keyboard and pressing R.
  2. In the run box, enter CMD and click OK.
  3. In the Command prompt window, create a directory to store your key. We recommend C:\Backup.
    MD C:\BACKUP
    
  4. Now, change directory to the Grsync installation by entering the following into the Command Prompt:
    CD "C:\PROGRAM FILES\GRSYNC\BIN"
    
    Note: Be sure to enclose the path in double quotes.
  5. In the grsync\bin directory, enter the following to create an key pair:
    ssh-keygen -f c:\backup\ssh_key -t rsa -N ''
    
    Note: The command ends with two single quote characters.

Uploading Your Public Key to Your linux host

Next, you'll need to upload the public key to your linux account. Enter the following into the Command Prompt (all on one line):

rsync -e ssh /backup/ssh_key.pub user@user.evbackup.com:ssh_keys/key1.pub

Notes:

  • Substitute user with your linux account name.
  • When you enter this command, you are going to see a message because your computer is being introduced to the server. Just enter yes when prompted and you'll never be bothered again.
  • You'll be asked to enter the password for your linux account. Once the key is uploaded and activated, this won't be necessary again.
  • If Terminal simply returns (looking as though nothing has happened), then you have successfully uploaded your key!

Activating Your Public Key

Next, you need to do is to activate your key on the linux server. To do this, enter the following into the Command Prompt:

ssh user@user.evbackup.com "echo $(cat ~/.ssh/key1.pub) >> .ssh/authorized_keys"

The final thing that you need to do is test that you can login without a password. Enter the following into the terminal:

ssh -i c:\backup\ssh_key user@user.evbackup.com

If you are successful, then something very similar to the following will appear in the window:

Last login: Thu Jul 15 16:16:44 2010 from c-28-26-13-101.
Copyright (c) 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.

FreeBSD 6.4-STABLE (EXAVAULT) #1:
[your-account@quark ~]$

Enter exit at the prompt and close the Command Prompt. You're all set!


Notice :
Si la commande addkeys ne fonctionne pas, dans le fichier authorized_keys du server linux, ajouter le contenu du fichier key.pub.

Configuring a Backup Session

Notice :

If you are using 64-bit Windows, you will need to run Grsync in Compatability Mode:

  1. Right-click the Grsync icon on the desktop.
  2. Select the Compatability tab
  3. Check (✔) run this program in compatibility mode for checkbox and select Windows XP (Service Pack 3) from the drop-down list.
.

Now it's time to open up Grsync and get it configured. First, set your prefereneces by clicking the File menu, selecting Preferences. Here are a few suggestions for Grsync preferences:

   ✔ Show rsync output by default
   ✔ Show error list when finished
   ✔ Enable logging

Saving a Grsync Backup Session

The next thing to do is to create a backup session and set the directories. To add a backup session Just click the add button on the toolbar.

  • Give your backup session a name that will be descriptive like, "My-Documents" or "Web-files".
  • You'll want to avoid using s p a c e s in your session names as they make automation a bit more difficult.
  • The source directory is the files that you will be backing up. Click the Open button to browse and select the root backup folder for the session.
  • The destination directory is your linux account. For example, if your linux account is bobsmith.evbackup.com, and you want to backup into the work-files folder on the server, then your destination will look like this:
    bobsmith@bobsmith.evbackup.com:work-files
    
  • Remember: you can create more than one session. Make your backup sessions discreet so that they run quickly and are fault-tolerant.

Setting Session Options

Next, set the options that you'll need for your backup. Here's a few suggestions:

Basic Options tab:

   ✔ Preserve time
   ✔ Preserve permissions
   ✔ Delete on destination (Use with caution!)
   ✔ Verbose
   ✔ Show transfer progress
   ✔ Skip newer

Advanced Options tab:

   ✔ Compress file data

Selecting your SSH Key

Next, select the SSH key that you created and uploaded previously so that you can login to your EVBackup account without a password. To select your SSH private key:

  • Select the Advanced options tab in Grsync.
  • Add -e "ssh -i c:\backup\private_key" into the Additional options box.

For example, if your name is Bob Smith and you stored your private key in c:\backup\ Then the Additional options might look like this:

-e "ssh -i c:\backup\private_key"

Testing the Backup Session With a Simulated Backup

Once you are configured, you'll want to do a simulated backup to make sure that everything is setup correctly. To simulate a backup session, select the Simulation option from the File menu.

  • If you see the files you expect to be backed up -- and you don't see any errors, then you are good to go!
  • If you need some assistance, please let us know:

Once your simulated backup runs without errors:

  1. Go ahead and run your first backup: Click the Execute option from the File menu
  2. Save the session so you can automate it later.

Automating Grsync Backups

Notice :
Il faut d'abord vérifier que le répertoire C:\Program Files\Grsync\bin fasse partie du PATH Windows. Si ce n'est pas le cas, il faut le faire..

The automation for Grsync is pretty straight forward:

  1. Save a Grsync session.
  2. Schedule a task:
  • Windows Vista, Windows 7, Server 2008: Setup a Task in Task Scheduler »
  • Windows XP, Windows 2000, Server 2003, Server 2000: Setup a Task in Scheduled Tasks »

Automating Grsync for Windows 7, Vista, and Server 2008

Open Task Scheduler from Control Panel > Administrative Options. To get started, click the the Action menu and select Create Task.

  1. Set the General tab options:
  • Enter a short but descriptive name for your Grsync job in the Name box.
  • Select the following Security options:

✓ Run whether user is logged on or not. ✓ Run with highest privileges.

  • Windows 7 64-bit: Make sure to select the "Windows XP" option from the Configure for: drop-down box
  1. Set the Triggers tab options:
  • Click the New button to create a new trigger and select On a Schedule from the drop-down box.
  • For settings, select a schedule when you want to run the Grsync backup job.
  • Make sure that the Enabled box is checked.
  1. Set the Actions tab options:
  • Click the New button to create a new Action and select Start a program from the drop-down box.
  • Click the Browse button to navigate to the location where you installed Grsync (C:\Program Files\Grsync\bin).
  • In the add arguments box, enter the following:
    -e name-of-your-Grsync-session
    
  1. Set the Conditions tab options:
  • Enable the Start only if the following network connection is available option.
  • Select the Any connection option from the drop-down box.
  1. On the Settings tab, select the following options:

✓ Allow task to be run on demand. ✓ Stop the task if it runs longer than 1 day.

  1. Click OK to close the Create Task window and set the username and pass to automatically run the task. Enter your username and password.

You're all set. You will see your backup task in the Task Scheduler window when you click on the Task Scheduler Library node in the Explorer tree on the left-hand side.

Automating Grsync for Microsoft Windows XP & 2000, Server 2003 & 2000

Automating Grsync in Microsoft Windows is done with the Scheduled Tasks. You can open Scheduled Tasks from Control Panel.

  1. In the Scheduled Tasks window, double-click Add Scheduled Task. The Scheduled Task Wizard will appear. Click the Next button to get started.
  2. Click the Browse button and navigate to the location where Grsync is installed (the default is: C:\Program Files\Grsync\bin).
  3. Enter a descriptive name for your Grsync job in the Name box. For example:
    Grsync to EVBackup --My Documents
    
  4. Set the schedule frequency (Daily, weekly, etc.) for the backup job. After you set the schedule frequency, click the Next button.
  5. Set the time for your backup job to start. Typically this is sometime in the evening after business hours. When you have set the time, click the Next button.
  6. Enter a username and password for a a user that can run the task. After you have set the user credentials, click the Next button.
  7. In the final window, Check the box to open the Advanced Properties window for your task and click the Finish button.
  8. In the Advanced Properties window, edit the run box and add the following after "C:\Program Files\Grsync\bin\grsync.exe"
    -e session-name-here
    

You're all set! You will see your backup task in the Scheduled Tasks window.

Références

<references/>