rsync with ssh-rsa+authorized_keys
security, shell | pfortuny | (0)
Much like explained in a previous post, one can use a passwordless RSA key to set up a cron job doing an rsync of one's computer on a remote server, via ssh.
The relevant part of the authorized_keys file is (everything in the same line):
command="rsync --server -vlogDtpr . /home/pfortuny/backup/",no-port-forwarding,
no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa .....
Taking into account that the -vlogDtpr depends on the specific options of the rsync command you issue. In my case, the script is simply (right now)
$ cat ./bin/backup.sh
#!/bin/sh
cd /home/pfortuny
/usr/bin/rsync -av -e "ssh -i /home/pfortuny/.ssh/backup_key" --filter ":
.rsync.dirs" \ ~/ pfortuny@remote.server.mine:"~/backup/"
Comments:
The option -av is expanded to -vlogDtpr on the server, ...