Using winscp to back up my mom’s files

My mom has a computer, but it has been years since I encouraged her to have any sort of data backup plan. I have two low-cost, low pain (for her) options for attempting to secure her data.

  1. Plug a USB drive into the back of her PC, and script an xcopy command (or something similar) so that every hour or so, it copies her important files to the drive. This would be cheap (she doesn’t have that much data), and pretty easy. The solution would protect against drive failure, but not against robbery, fire, or flood.
  2. Use winscp to securely copy her files over her internet connection to my NSLU2 network storage. This is more complicated, costs nothing but a bit of time to figure it out, and protects against all possible forms of data loss (unless our whole city is consumed with a fire or flood).

Since I’m already sharing my NSLU2 with Skippy, and I’ve got way more space than she’ll ever need, and I like a bit of a challenge, I’ll go with winscp.
Some pre-requisites that I’ve already got set up:

  • NSLU2 running Unslung.
  • Use OpenSSH for remote access.
  • Forward a port on my router to the OpenSSH port on my NSLU2.
  • Establish an account with a Dynamic DNS host, such as DynDNS.com, and set up my router to check in with DynDNS to update my IP address periodically.

Now, on to using winscp for this application.

  1. Download the “portable” version of winscp and  save it to a new directory. I renamed it from winscp416.exe to just winscp.exe.
  2. Create a new user on my NSLU2 for my mom, and give the account ssh access.
  3. Establish the first winscp session to my NSLU2 to save the security keys: winscp sftp://user:password@host:port
  4. Save that session in winscp by choosing Save Session… from the Session menu. The default name was user@host, and I chose to keep the password.
  5. Create a list of winscp commands, and store them in winscp-commands.txt. The following commands will copy everything from the current directory structure to the home directory on the NSLU2.

    option batch on
    option confirm off
    option transfer binary
    synchronize remote -delete
    close
    exit

  6. Create a batch file, named backup-files.cmd with the following command
    winscp user@host /console /script=winscp-commands.txt
  7. Set backup-files.cmd to run as a scheduled task.

The “synchronize remote -delete” command will put all files from the local directory into the remote directory, deleting any files on the remote that have been removed from the local.

It is also possible to add multiple synchronize commands to this file, but be careful, because the remote directory must exist for the sync to work. For example:

synchronize remote -delete “c:\documents and settings\me” /user/my_stuff

will only work if the directory /user/my_stuff already exists.

One thought on “Using winscp to back up my mom’s files”

Comments are closed.