Jump to content

Rsync: Difference between revisions

From NixOS Wiki
Klinger (talk | contribs)
m Category:Applications
Klinger (talk | contribs)
m Category:CLI Applications added, link added
(One intermediate revision by the same user not shown)
Line 1: Line 1:
rsync is a utility for efficiently transferring and synchronizing files between a computer and an external hard drive and across networked computers by comparing the modification times and sizes of files.
[https://rsync.samba.org/ rsync] is a utility for efficiently transferring and synchronizing files between a computer and an external hard drive and across networked computers by comparing the modification times and sizes of files.


== Running a server ==
== Running a server ==
Line 27: Line 27:


[[Category:Applications]]
[[Category:Applications]]
[[Category:CLI Applications]]
[[Category:Backup]]

Revision as of 19:20, 29 December 2024

rsync is a utility for efficiently transferring and synchronizing files between a computer and an external hard drive and across networked computers by comparing the modification times and sizes of files.

Running a server

Running rsync via SSH is recommended for security reasons.

You can restrict an SSH user to rsync command using pkgs.rrsync:

users.users.backup = {
  isNormalUser = true;
  openssh.authorizedKeys.keys = [
    ''command="${pkgs.rrsync}/bin/rrsync /home/backup/dir/",restrict ssh-ed25519 AAAAC3NzaCetcetera/etceteraJZMfk3QPfQ''
  ];
};

Now you should be able to backup to your directory with the rsync client:

$ rsync -Pav -e "ssh -i $HOME/.ssh/somekeys" photos backup@server:

See rrsync.1 for additional options, such as enforcing read-only or write-only access.