How To Use Rsync Without Password

The rsync utility allows you to transfer and synchronize files between your PC and an external hard drive. You can also use it to send files across a local area network to all devices, but to do that, the receiving party has to enter the correct password. However, there is a trick you can use to get your devices rsynced without using any passwords. Read on to learn how to bypass the password using SSH or SCP commands.

rsync basics

How to RSYNC Without Using a Password

You can set up your rsync over ssh and you can then use it without a password. The feature is great for scheduling cron jobs for automatic backup when using rsync. Here is how you can work around the password.

First, you have to test out rsync over ssh while using an existing password.

Do a standard rsync like you do all the time to ensure that you are asked to enter your password on the remote server. Copy some files just to make sure that the remote server is working.

Use this example to sync your local folder/home/pies with the remote folder/backup/pies. Use the server command.

After you execute this command, you will be prompted to enter your account password on the remote server: rsync -avz -e ssh /home/pies/ [email protected]:/backup/pies/

The next step is to configure ssh to skip the part where it asks for your password. Use the ssh-keygen command on your local server to create private and public keys. Use the following command:

$ ssh-keygen
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

NOTE: After you are prompted to enter a passphrase, just leave the section blank and press Enter.

Copy the public key to your remote host by using ssh-copy-id. Enter the following command: ssh-copy-id -i ~/.ssh/

You will then be prompted to enter the password on your remote host, and you will have to copy the public key to the right location.

Now, when everything is set up, you are ready to rsync without a password. Use this command: ssh to rsync without entering your password. Here’s the rsync you should use: rsync -avz -e ssh /home/pies/ [email protected]:/backup/pies/. You can also automate this rsync backup and schedule it with cron.

Rsync Commands in Linux

Other Practical Rsync Commands in Linux

Rsync or Remote Sync can help you get a lot done quickly, and that includes copying and synchronizing files remotely. Here are some useful commands you can use to speed things up when working remotely.

Copy and Sync Files on a Computer

The command below will sync a single file on your local computer from one location to another. Copy a file called backup.tar to /tmp/backups/ folder for it to work.

[[email protected]]# rsync -zvh backup.tar /tmp/backups/
created directory /tmp/backups
sent 14.71M bytesreceived 31 bytes3.27M bytes/sec
total size is 16.18Mspeedup is 1.10

The example above is for situations where the destination folder/directory doesn’t exist in rsync already and you want to create one automatically.

Copy and Sync Directories on a Computer

The next command will sync or transfer all files from one directory to a different one on the same computer. Here’s an example: /root/rpmpkts has some rpm package files and you want to copy it to the /tmp/backups/ folder. Use the following command:

[[email protected]]# rsync -avzh /root/rpmpkgs /tmp/backups/
sending incremental file list
sent 4.99M bytesreceived 92 bytes3.33M bytes/sec
total size is 4.99Mspeedup is 1.00

Copy and Sync Files and Directories to/from a Server

Copying a directory from the local server to a remote server is done by using the following command:

[[email protected]]$ rsync -avz rpmpkgs/ [email protected]:/home/
[email protected].101's password:
sending incremental file list
sent 4993369 bytesreceived 91 bytes399476.80 bytes/sec
total size is 4991313speedup is 1.00

It will transfer the files from “rpmpkgs” folder to the remote server you want.

When you want to copy files from a remote server to your local machine, use this command:

[[email protected]]# rsync -avzh [email protected]:/home/tarunika/rpmpkgs /tmp/myrpms
[email protected]'s password:
receiving incremental file list
created directory /tmp/myrpms
sent 91 bytesreceived 4.99M bytes322.16K bytes/sec
total size is 4.99Mspeedup is 1.00

You can use it to sync a remote file or directory and copy it to your local machine.

Bypass the Password and Rsync Anyway

If you use Linux and a remote server a lot, it’s useful to know these commands because they can help you get things done much faster. You can now copy and sync files with these basic commands.

Leave a Reply

Your email address will not be published. Required fields are marked *

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.