Difference between revisions of "Rsync"

From Hackepedia
Jump to navigationJump to search
(Created page with "Trying to backup remotely using rsync + ssh so the transfer is encrypted. Two things non-standard in my setup, I use a non-standard ssh port (4321), and I'm connecting from t...")
 
 
Line 3: Line 3:
  
 
  $ rsync -avz -e 'ssh -p4321' /client/homedirectory remoteuser@remotehost:/remote/backup/directory
 
  $ rsync -avz -e 'ssh -p4321' /client/homedirectory remoteuser@remotehost:/remote/backup/directory
 +
 +
From Dir1 to Dir2:
 +
 +
$ rsync -av --delete /Directory1/ /Directory2/
 +
–delete = This tells rsync to delete any files that are in Directory2 that aren’t in Directory1.
 +
 +
to exclude a few:
 +
 +
--exclude={"/tmp/*","/proc/*"}

Latest revision as of 12:58, 2 May 2021

Trying to backup remotely using rsync + ssh so the transfer is encrypted. Two things non-standard in my setup, I use a non-standard ssh port (4321), and I'm connecting from the box I want backed up, to the server. In most examples, you're connecting from the server, to the client.

$ rsync -avz -e 'ssh -p4321' /client/homedirectory remoteuser@remotehost:/remote/backup/directory

From Dir1 to Dir2: 
$ rsync -av --delete /Directory1/ /Directory2/
–delete = This tells rsync to delete any files that are in Directory2 that aren’t in Directory1.
to exclude a few:
--exclude={"/tmp/*","/proc/*"}