OBJECT can be several files or directories (several, when using wildcards). The -p flag specifies the ssh port number on the remote host to connect to, so if your remote ssh demon listens on a different port number, you need to replace the default 22 with that port number. The parent directory on the target machine (in the above example DESTINATION) must already exist. Once you have verified that you can establish an ssh connection, you can now use this command: rsync -azhe "ssh -p 22 -i /path/to/.ssh/keypair/private_key_file" -progress /path/to/items/on/the/LOCAL/HOST/DESTINATION/
ACROSYNC BETWEEN TWO REMOTE SERVER HOW TO
To set up the keys, follow steps 1 through 5 in this tutorial: How to Set Up a Connection between Two Hosts Using Authentication Based on Key Pairs for Remote Access via ssh, rsync. To initiate an rsync pull from a remote host to the local host, you need to set up ssh with the private key placed locally (preferably in $HOME/.ssh of the active local user) and the corresponding public key located on the remote computer (in a separate line inside the file authorized_keys in in $HOME/.ssh of the remote user).
![acrosync between two remote server acrosync between two remote server](https://www.atlantic.net/wp-content/uploads/2018/01/anet-rsync-001-1024x328.png)
To initiate an rsync push from the local host to a remote host (or from one remote host to another) via ssh, you can use this command at the prompt of the host that will push its data: rsync -azhe "ssh -p 22 -i /path/to/.ssh/keypair/private_key_file" /local/path/to/source-directory rsync pull: transfer data from a remote host to your local host Rsync push: transfer data from your local host to a remote host a pull operation transfers data from the remote host to the local host.a push operation transfers data from the local host to the remote host,.Synchronizing local directories using rsync is a piece of cake, but what if you want to securely rsync files and directories between two separate hosts using ssh with public key authentication over the network? Easy. It tells rsync to traverse subdirectories. Without the trailing slash, your source-directory would become a sub directory of your destination-directory (in this case, both on the same host). The trailing slash / ensures that the contents of your source-directory would transfer to the destination-directory (in this case) on the same host. To synchronize the contents of two directories on your local machine, use the rsync utility like this: rsync -r source-directory/ destination-directory rsync for starters: synchronizing the contents of two local directories It goes without saying that rsync can have disastrous consequences if performed incorrectly, so whenever in doubt, initiate a –dry-run and always think before you type. an rsync pull from a remote host to the local host.an rsync push from the local host to a remote host.how to synchronize the contents of two local directories.
![acrosync between two remote server acrosync between two remote server](https://winaero.com/blog/wp-content/uploads/2017/10/rpd-port-value.png)
The rsync utility can backup files, synchronize directory trees, and much much more, both on the local machine and between two different hosts-via push and pull.