Rsync pull - Host key verification failed

  • I have set up an Rsync job to backup my Nextcloud data folder (NC running on a Raspberry Pi on my local network) to my OMV server. So far I did the following:
    - As the Nextcloud data folder is owned by www-data, I created a user "NCrsync" on the Pi and added it to the www-data group
    - In the OMV GUI, I created a new SSH key and tried to copy the public key to the Pi which failed as the GUI can't handle the "Trust this RSA key" prompt. So I created the file /home/NCrsync/.ssh/authorized_keys on the Pi, copied the public key from the OMV GUI and pasted it into this file
    - Set up an Rsync job in the OMV gui with the following settings:

    Code
    Type: Remote
    Mode: Pull
    Source server: NCrsync@<pi-ip>:/media/hdd1/data
    Destination folder: shared folder on my OMV server
    Authentication: Public key
    SSH port: 22
    SSH certificate: nc-rsync


    However, if I start the Rsync job, it fails:


    What could be the reason for this to fail?


    Thank you very much in advance!

  • Well, something went wrong with the key exchange.
    The easiest way I know is to simply use
    ssh-copy-id NCrsync@<pi-ip>
    This will allow to connect to your pi without getting asked for the password, until keys change.
    If it is only about key verification just log in via ssh once and accept the key so it gets written into know_hosts.
    Also you should use lower case user names only, upercase may cause unexpected behaviour.

    • Offizieller Beitrag

    Also if a windows computer is involved when copying/editing that may have borked some file. Bad coding/newlines.

    Be smart - be lazy. Clone your rootfs.
    OMV 5: 9 x Odroid HC2 + 1 x Odroid HC1 + 1 x Raspberry Pi 4

  • I have set up an Rsync job to backup my Nextcloud data folder (NC running on a Raspberry Pi on my local network) to my OMV server. So far I did the following:



    Did you ever manage to get this to work?


    I tried creating an SSH certificate and copy it to the remote server with build in tool. It didn't work, I am guessing, because of the issue you mentioned. I then tried copying the certificate to authorized_keys of the remote server. Even when I try to SSH to that server it doesn't work let alone rsync. So I created an SSH key using the old method with ssh-keygen and copied it to the remote server. Validated that I could login without password. Updated everything in Rsync page but I still can't get Rsync to work.




    Done ...
    I tested a manual Rsync command and it seems to run just fine. So I am not sure what's wrong with the inbuilt tool.

    Code
    rsync -avzh user@1.0.3.1:/mnt/volume/ data/ServerBackups/
  • hi
    For the archive and others with this problem.


    go to the OMV server via SSH as root. "root@<omv>"
    connect via SSH to your RSYNC server. "<any Username>@<pi-ip>"
    accept the hostkey by entering 'yes'
    login or disconnect.


    The problem is a missing entry for the hostkey in /root/.ssh/known_hosts.
    under OMV Rsync runs as root

  • No luck with this :(


    I have been using OMV 4 for a year and set up a rsync job using the web interface of OMV. Now, with OMV 5.3.5-1, I can't. I always get the same result:


    Code
    Please wait, syncing <myuser@192.168.1.11:/prueba> to </srv/dev-disk-by-label-HDBACKUPSERIES/Series/Series/Prueba/> ...
    
    
    Permission denied, please try again.Permission denied, please try again.myuser@192.168.1.11: Permission denied (publickey,password).rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]rsync error: unexplained error (code 255) at io.c(235) [Receiver=3.1.3]
    
    
    The synchronisation has completed successfully.Hecho ...


    What I'm trying to set is a rsync job between a PC (Ubuntu 18.04) that I use as a media server and OMV 5 as a remote backup server (local network) installed into a Raspberry with two HD connected by USB. It worked for a long time but now I can't do it again.


    I have also done:

    Code
    ssh -l pi 192.168.1.102
    sudo su
    ssh -l myuser 192.168.1.11


    (then, accepted the new fingerprint)


    And also the opposite way:



    Code
    ssh -l myuser 192.168.1.11
    sudo su
    ssh -l pi 192.168.102


    (then, accepted the new fingerprint)


    Help anybody? Probably the problem is caused by something obvious but I've spent a week trying to figure it out with no luck :(


    Thanks guys.

  • Just in case someone arrive here from google... What I have done to solve this (I don't know if it's the right thing to do but nobody has told me anything here, so... ) and has worked is:


    1. Install samba in my media server (Ubuntu 18.04), from where I want to copy the files to backup. Edit smb.conf to share the directories where the files are.
    2. In OMV5, install the remote mount plugin and create the mount points (the directories shared by the media server) and reboot omv. If I don't reboot it does not work.
    3. Create the shared folders in OMV (every folder of the media server that I want to copy and every folder in OMV where I want to put the backup).
    4. rsync local folders (the remote points and the local folders where I want to move the backup).


    When I used OMV 4 it was way easier to achieve this, but now I have to do all this to get the same results. Not cool :(


    ----


    Better solution... Actually, the right solution:


    1. Generate certificate ssh (System > Certificates).
    2. Copy it into the media server (from where I want to get the copies).
    3. Create the rsync jobs (pulling method) selecting 'Public key' as a Authentication method and select your certificate.

  • Hi Itookmyprozac

    Thank you very much for your instructions #8, rsync works great now.

    Just want to add a little more to your solution, I need things really basic.


    Better solution... Actually, the right solution: credits Itookmyprozac

    1. Generate certificate ssh (OMV > System > Certificates > SSH)

    a. click Add, Add, enter a comment i.e. omv-ssh-certificate

    b. click Save

    2. Copy it into the media server (from where I want to get the copies) (OMV > System > Certificates > SSH > Copy).

    a. click on omv-ssh-certificate to select it

    b. click Copy

    c. enter details of server to send/copy to

    d. click Copy

    3. Create the rsync job(s) via OMV UI

    a. Type = Remote

    b. Mode = Pull

    c. Source server = source_server_username_or_adminusername@<IP>:/dir1/dir2/etc/

    d. Authentication = Public key

    e. SSH port = 22

    f. SSH certificate = omv-ssh-certificate

    g. other settings as desired


    Try a Dry Run to test connectivity.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!