How To Copy Files With Rsync Over SSH

How To Copy Files With Rsync Over SSH

How To Copy Files With Rsync Over SSH

If you need to transfer files between two remote servers securely, you can use rsync over SSH.

Rsync is a fast and versatile file synchronization tool that can copy files locally or between remote servers over SSH. It supports incremental backups, partial transfers, and compression, making it an ideal choice for file transfer over a slow or unstable network connection.

Here's how to use rsync over SSH to copy files from one remote server to another:

  1. Open a terminal window on your local machine.
  2. Connect to the source server over SSH:
    ssh user@source-server
  3. Run the rsync command to copy the files to the destination server:
    rsync -avz --progress /path/to/source/files user@destination-server:/path/to/destination/files
  4. Enter your SSH password when prompted.
  5. Wait for rsync to complete the file transfer.
  6. Disconnect from the source server:
    exit

The -a option preserves file permissions, ownership, timestamps, and symbolic links. The -v option enables verbose output, so you can see the progress and status of the file transfer. The -z option compresses the data during transfer to reduce the network bandwidth usage. The --progress option shows the progress of the transfer.

Make sure you have SSH access to both the source and destination servers, and that you have the necessary permissions to read and write files on both servers.

You can also use rsync over SSH to copy files between your local machine and a remote server:

  1. Open a terminal window on your local machine.
  2. Run the rsync command to copy the files to the remote server:
    rsync -avz --progress /path/to/local/files user@remote-server:/path/to/destination/files
  3. Enter your SSH password when prompted.
  4. Wait for rsync to complete the file transfer.

That's it! You now know how to use rsync over SSH to securely transfer files between remote servers or between your local machine and a remote server.

Keywords: rsync, SSH, file transfer, tutorial, incremental backups, partial transfers, compression, network connection, verbose output, file permissions, ownership, timestamps, symbolic links, progress of the transfer, local machine, remote server, read and write files, securely transfer files.

Комментарии

Популярные сообщения из этого блога

How To Modify CSS Classes in JavaScript

How To Backup MySQL Databases on an Ubuntu VPS

How To Backup PostgreSQL Databases on an Ubuntu VPS