The Lazy Admin Blog

Home  /  CentOS • CloudLinux • Security  /  rsync without prompting for password

rsync without prompting for password

October 10, 2022 CentOS, CloudLinux, Security Leave a Comment

Rsync is a fast and extraordinarily versatile file-copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. When copying over ssh, rsync will need to authenticate with the receiving side using either password or key authentication. Since it’s a backup tool, and most of the time will be automated, we want to connect with the receiving side without prompting for password – using key authentication.

Step 1 – Generate RSA keys on the source server

ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:

Step 2 – Copy the key to the destination server

ssh-copy-id -i root@target-server-domain-or-ip.com
root@target-server-domain-or-ip.com's password:
Now try logging into the machine, with "ssh 'root@target-server-domain-or-ip.com'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.

If you are using an alternate ssh port (not 22), you can try and use this syntax –

ssh-copy-id "-p 1234" user@target-server-domain-or-ip.com

Replace “1234” with your port
Now test ssh connection from the source server to the destination server –

ssh root@target-server-domain-or-ip.com

When doing the first login you will be notified about “RSA key fingerprint” issue, approve it so he will be added “known_hosts” so the alert won’t show up again.

Tags: rsync, ssh
Previous Article

Leave a Reply

Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search Our Blog

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
Apache
CentOS
CloudLinux
cPanel
Emails
ESXI
iSCSI
JetBackup
Litespeed
MySQL
NGINX
Oracle
Reduxio
Security
SSL
Uncategorized
VMware
Wordpress
XEN

Tags

apache aspx backup CentOS cloudlinux cPanel CXS Emails freetds google htaccess IMAP InnoDB iscsi JetBackup Libmodsecurity litespeed modsec modsecurity mssql MySQL netapp nginx odbc Oracle php php.ini phpselector rsync ssh VMFS WHM Wordpress xenserver

Popular Posts

  • Allow a cPanel server to run a VHOST from multiple IP addresses April 3, 2018
  • How To Install & Configure a Galera Cluster with MySQL on Centos 7 February 6, 2018
  • Libmodsecurity installation April 14, 2016
  • JetBackup Cheat Sheet :: Automatically Acknowledge Alerts November 15, 2018

Recent Posts

  • rsync without prompting for password October 10, 2022
  • Convert JetBackup to cPanel structure October 6, 2022
  • Configure LiteSpeed Crawler October 5, 2022
  • Change Hostname in Oracle Cloud Infrastructure (OCI) October 3, 2022

Recent Comments

  • Anonymous on InnoDB: Failed to find tablespace for table `X` in the cache
  • Khan on Allow a cPanel server to run a VHOST from multiple IP addresses
  • Khan on Allow a cPanel server to run a VHOST from multiple IP addresses
  • Oleg Drabkin on Allow a cPanel server to run a VHOST from multiple IP addresses
  • Khan on Allow a cPanel server to run a VHOST from multiple IP addresses
Privacy Policy • Contact