Dino Geek, try to help you

How to use RSYNC to copy files between two servers without password?


Rsync is a robust utility used frequently in Linux environments for copying and synchronizing files and directories between two locations. It offers numerous options for synchronization and preservation of files and is cherished for its speed and versatility. To copy files between two servers without a password, we need to combine the capabilities of Rsync and SSH (Secure Shell).

First, ensure that Rsync is installed on both servers. If not, it can be installed with the following commands:

- On a Ubuntu/Debian server: `sudo apt-get install rsync`
- On a CentOS/RHEL server: `sudo yum install rsync`

Next, consider the server you wish to pull/push the files from as the Source server, and the one you wish to push/pull the files to as the Destination server.

The main requirement for passwordless transfer is setting up SSH keys between the two servers. This involves generating a public-private key pair on the Source server and copying the public key to the Destination server.

Here’s how to do that:

- Login to the Source server.

- Create an SSH key pair with the following command: `ssh-keygen -t rsa`
- When prompted to “Enter file in which to save the key”, press Enter to accept the default location.
- When asked to “Enter passphrase”, hit Enter for no passphrase. Note that this is not recommended for production environments due to security reasons.
- Copy the public SSH key to the Destination server with this command: `ssh-copy-id -i ~/.ssh/id_rsa.pub user@destination_server`, where `user` is your username and `destination_server` is the hostname or IP address of the Destination server.

Now SSH connection from Source to Destination server won’t require a password.

To use Rsync without password:

- On the Source server, use the following command:
`rsync -avz /source/directory/ user@destination_server:/destination/directory/`

In this command:

- `a` stands for archive mode.

- `v` increases verbosity.

- `z` compresses data during transfer which increases speed.

- `/source/directory/` is path of the data on the Source server.

- `user@destination_server:/destination/directory/` is the path where you want to move the data on the Destination server.

You can also automate this syncing process by putting this command into a cron job.

Sources:

- George Ornbo (2014). “SSH, The Secure Shell: The Definitive Guide”.
- HD Moore (2011). “Metasploit: The Penetration Tester’s Guide”.
- K Asghar (2008). “Linux Administration: A Beginners Guide”.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use