BackupFromWindowsToLinux

From RdiffBackupWiki

Jump to: navigation, search

As Microsoft Windows does not have ssh native the rdiff-backup.exe has to be instructed how to connect to a remote host. There are many ssh clients for windows. I prefer the popular ssh client putty but this documentation is probabably easy to adapt to other SSH clients too.

Contents

Configuring SSH with public key authentication

  • Generate a keypair with puttygen.exe. (This is a windows program with a GUI, just start it, no installation required, hit generate, then move the mouse to create random seed.)
  • Save the private key, without a Key passphrase, to a file named privatekey.ppk. Leave puttygen open for the moment...
  • Still from your Windows computer, log in to the Linux system with putty.exe, supplying your Linux username and password. Within putty, decide whether you are going to use /home/user/.ssh/authorized_keys or /root/.ssh/authorized_keys on the linux server (depends on which user account you are going to use.) If using the first, and the directory (~/.ssh) doesn't exist, create it with mkdir ~/.ssh. Do nano -w ~/.ssh/authorized_keys or su nano -w /root/.ssh/authorized_keys to edit/create authorized_keys. Copy the public key from the puttygen window, and paste (right-click) it directly into a new line in this file, then exit nano with CTRL+X and save the change.

Verify that passwordless login works with the private key file

From a command prompt execute the following

plink.exe -i privatekey.ppk username@servername.domainname

Important! You have to answer 'yes' to accept the fingerprint of the server. If this not is done rdiff-backup can't use plink.exe and won't work nor give you the possibility to answer 'yes'.

If everything works you should now be logged in to the remote server without having to enter a password.

Syntax to launch rdiff-backup.exe

rdiff-backup.exe -v5 --no-hard-links --print-statistics
  --remote-schema "plink.exe -i privatekey.ppk %s rdiff-backup --server"
  c:\sourcedirectory username@servername.domainname::/destinationdirectory

In this example -v5 (verbose level 5) and --print-statistics aren't necessary but I often prefer to use them. All three lines above should be on one line when launching rdiff-backup.

If you want to backup all of the C drive, then use c://\ instead of c:\sourcedirectory.

Hints on using native win32 rdiff-backup in windows

  • If using rdiff-backup versions prior to 1.2.1: You will propably want to use the --no-hard-links option. Otherwise rdiff-backup stores a diff for every file even when there are no changes. This is happening because windows does not have inode numbers in the filesystem. From release 1.2.1 this option is automatically disabled when running in Windows.
  • If called from a DOS batch file the %s must be written as %%s.
  • %s in the command line must exist and should NOT be a "hardcoded" servername which will result in a syntax error.

Known problems

  • It seems to be a problem in release 1.2.0 to directly specify c:\ as the source directory. c:\. works but then include/exclude statements doesn't work. Changing the working directory to the root and using a single dot (.) as source also work but still a problem with include/exclude. For latest status regarding this problem, see https://savannah.nongnu.org/bugs/?24100
Personal tools