If you can ssh to a remote server using your public key, but want rsync to be executed as a different user, you can achieve it like this: On the remote host add an entry in /etc/sudoers which looks like this (replace the username accordingly): user1 ALL=NOPASSWD: /usr/bin/rsync * This will allow your user account […]
First install lsyncd, on Ubuntu/Debian just like this: sudo apt-get update sudo apt-get install lsyncd There are some needed folders that are not automatically created: mkdir -p /etc/lsyncd /var/log/lsyncd Now let's take a sample file and copy it to /etc/lsyncd/lsyncd.conf.lua where lsyncd will automatically pick it up: cp /usr/share/doc/lsyncd/examples/lrsyncssh.lua /etc/lsyncd/lsyncd.conf.lua Here's a sample configuration: settings […]
rsync -rave "ssh -i your_aws_key.pem" /path/to/local/files ec2-user@EC2_INSTANCE:/path/to/remote/files r: recursivea: archivev: verbosee: remote shell command (ssh -i…) If you just want to synchronize an existing folder, you might want to try the update flag (-u).
A quick note before starting: passing passwords in plaintext is highly discouraged for security reasons!! If you need to, be sure to secure your script! Installation on Debian: apt-get install sshpass Login to a ssh server example.net with user tester and password 12345: sshpass -p '12345' ssh firstname.lastname@example.org This also works with rync (but consider SSH […]
Some important information at the beginning about rsnapshot: rsnapshot is not creating a full backup every time, it's creating incremental backups to save space. Therefore rsnapshot is using hard links and creating a folder structure containing daily.0, daily.1, weekly.0, weekly.1, etc. You can install the needed packages on Debian by executing as root: apt-get install rsync rsnapshot On […]