Cygwin and crontab backups via ssh/scp/rsync

Install the "Editors" and "Net" groups that will give you rsync, ssh, ssh-keygen and cron.

The trickiest thing that I keep forgetting about each time is you have to run "cron-config" which adds the cron service to Windows, and without doing that obviously no cron jobs will be run thus making automatic backups impossible.

Warning about rsync/cygwin and using the -a archive switch.

It's a good thing I caught this because it doesn't work right when trying to use -a.  I noticed many directories would be created on the Linux side with permissions of 000, almost at random.  In plain English if you use the -a switch or try to preserve permissions then you are pretty much guaranteed that not all of the expected files and directories will be backed up by your rsync script.  Supposedly this is not a bug but the fact that Windows filesystem permissions do not always translate to expected/sensible results on the Linux end.  I personally believe cygwin or rsync should handle this and ensure that any directories are created with a least permissions of 700 to make sure the issue I found doesn't occur.  I can only imagine how many sorry people are out there who can't understand why their rsync backups seemed to fail or only backup some files they expected.

I got a lot of Error 13's/permission denied to write from rsync on the receiving end which was a Linux host.   I fixed it by doing a "chmod -R 755 *" on the entire directory path.  But the true fix is to not use the "-a" switch or to preserve permissions at all.

Here are the settings I use to rsync Windows files to Linux:

rsync -Phrt --ignore-errors /directory user@host:~/path

P displays the progress

h gives human readable info

r is recursive so you don't miss any subdirectories/files

t preserves the timestamp which does not cause any issues and works fine.


Tags:

cygwin, crontab, backups, via, ssh, scp, rsyncinstall, quot, editors, groups, rsync, keygen, cron, trickiest, config, adds, thus, archive, doesn, directories, linux, permissions, preserve, guaranteed, filesystem, translate, sensible, ensure, occur, receiving, chmod, directory, settings, phrt, errors, user, displays, readable, info, recursive, subdirectories, preserves, timestamp,

Latest Articles

  • qemu-kvm error "Could not initialize SDL(No available video device) - exiting"
  • Centos 7 tftpd will not work with selinux enabled
  • Debian Ubuntu Mint Howto Create Bridge (br0)
  • How To Control Interface that dhcpd server listens to on Debian based Linux like Mint and Ubuntu
  • LUKS unable to type password to unlock during boot on Debian, Ubuntu and Mint
  • Debian Ubuntu and Linux Mint Broken Kernel After Date - New Extra Module Naming Convention
  • Wordpress overwrites and wipes out custom htaccess rules and changes soluton
  • Apache htaccess and mod_rewrite how to redirect and force all URLs and visitors to the SSL / HTTPS version
  • python 3 pip cannot install mysql module
  • QEMU-KVM won't boot Windows 2016 or 2019 server on an Intel Core i3
  • Virtualbox vbox not starting "No suitable module for running kernel found"
  • Bind / named not responding to queries solution
  • Linux Mint How To Set Desktop Background Image From Bash Prompt CLI
  • ImageMagick Convert PDF Not Authorized
  • ImageMagick Converted PDF to JPEG some files have a black background solution
  • Linux Mint Mate Customize the Lock screen messages and hide username and real name
  • Ubuntu/Gnome/Mint/Centos How To Take a partial screenshot
  • ssh how to verify your host key / avoid MIM attacks
  • Cisco IP Phone CP-8845 8800/8900 Series How To Reset To Factory Settings Instructions
  • ls how to list ONLY directories