![]() ![]() To the remote machine, you will be asked to enter the user password. In the following example, we are transferring a directory from a local to a remote machine: rsync -a /opt/media/ you haven’t set a passwordless SSH login The new versions of rsync are configured to use SSH as default remote shell. , it must be installed on both the source and the destination machine. When using rsync to transfer data remotely Using rsync to Sync Data from/to a remote Machine # When the trailing slash is omitted, rsync copies the source directory inside the destination directory. If the source directory has a trailing slash, the command will copy only the directory contents to the destination directory. It is worth mentioning that rsync gives different treatment to the source directories with a trailing slash ( /). The example below shows how to create a local backup of website files: rsync -a /var/If the destination directory doesn’t exist, rsync will create it. The real power of rsync comes when synchronizing directories. If you want to save the file under a different name, specify the new name on the destination part: rsync -a /opt/filename.zip /tmp/newfilename.zip Omitting the filename from the destination location copies the file with the current name. The user running the command must have read permissions on the source location and write permissions on the destination. Here is an example: rsync -a /opt/filename.zip /tmp/ The most basic use case of rsync is to copy a single file from one to another local location. By default, rsync is configured to use ssh. This option allows you to choose a different remote shell. Use this option if you want to suppress non-error messages. When this option is used, rsync deletes extraneous files from the destination location. It is useful when transferring large files over slow or unstable network connections. When this option is used, rsync shows a progress bar during the transfer and keeps the partially transferred files. Use this option only if the connection to the remote machine is slow. This option forces rsync to compresses the data as it is sent to the destination machine. This option tells rsync to syncs directories recursively, transfer special and block devices, preserve symbolic links, modification times, groups, ownership, and permissions. -a, -archive, archive mode, equivalent to -rlptgoD.Rsync provides a number of options that control how the command behaves. ![]()
0 Comments
Leave a Reply. |