"Permission denied" when running rsync job

    • OMV 4.x
    • Resolved

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • "Permission denied" when running rsync job

      Hello Forum,

      I would like to maintain this command as rsync job in OMV web interface (4.1.12 (Arrakis):

      Source Code

      1. rsync --rsync-path=/storage/.kodi/addons/virtual.network-tools/bin/rsync -avb root@libreelec:/var/media/INTENSO/Fotos /sharedfolders/Backup/libreelec/

      When I execute this in OMV bash, I need to enter the password of root@libreelec and then all folders/files get pulled from Libreelec to my OMV system.

      These are my settings in rsync jobs:
      • Type: Remote
      • Mode: Pull
      • Source Server: root@libreelec:/var/media/INTENSO/Fotos
      • Destination shared folder: libreelec [on BK01, Backup/libreelec/]
      • Authentication: Password
      • Password: *****
      • all additional settings: unchanged
      • extra options: --rsync-path=/storage/.kodi/addons/virtual.network-tools/bin/rsync
      When I perform "run" I receive this error message:

      Source Code

      1. Please wait, syncing <root@libreelec:/var/media/INTENSO/Fotos> to </srv/dev-disk-by-label-BK01/Backup/libreelec> ...
      2. Permission denied, please try again.
      3. Permission denied, please try again.
      4. Permission denied (publickey,password,keyboard-interactive).
      5. rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
      6. rsync error: unexplained error (code 255) at io.c(235) [Receiver=3.1.2]
      7. The synchronisation has completed successfully.
      8. Done ...
      my user rights for folder /sharedfolders/Backup/libreelec (and subfolders):

      drwxrwxrwx 3 root root 19 Mai 9 09:37 libreelec

      My first Idea: I would like to check which rsync command is in fact composed (and executed) from my settings in the rsync job. Where can I find this?

      My second idea: is </srv/dev-disk-by-label-BK01/Backup/libreelec> the same as /sharedfolders/Backup/libreelec ?

      Any other ideas how to solve this?

      Many thanks for your kind support

      Newtren
    • Newtren wrote:

      My first Idea: I would like to check which rsync command is in fact composed (and executed) from my settings in the rsync job. Where can I find this?

      My second idea: is </srv/dev-disk-by-label-BK01/Backup/libreelec> the same as /sharedfolders/Backup/libreelec ?
      Hello forum,

      is this a reasonable approach to solve my issue?

      • How can I check the full rsync command which is composed by OMV?
      • Can someone confirm, that /srv/dev-disk-by-label-BK01/Backup/libreelec is the same as /sharedfolders/Backup/libreelec?
        Otherwise I need to search in a different direction
      • "Permission denied (publickey,password,keyboard-interactive)." - shall I try to setup a passwordless login with public key?

      Thanks for any hints

      Newtren
    • I suspected that there might be a cron/anacron job somewhere. I found it here:

      /etc/cron.d/openmediavault-rsync

      It contains

      Source Code

      1. SHELL=/bin/sh
      2. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
      3. # m h dom mon dow user command
      4. 13 8 * * * root /var/lib/openmediavault/cron.d/rsync-fcc54383-1496-4715-8ca7-d1e17016770a >/dev/null 2>&1

      So I checked

      /var/lib/openmediavault/cron.d/rsync-fcc54383-1496-4715-8ca7-d1e17016770a

      it contains

      Source Code

      1. SHELL=/bin/sh
      2. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
      3. # m h dom mon dow user command
      4. 13 8 * * * root /var/lib/openmediavault/cron.d/rsync-fcc54383-1496-4715-8ca7-d1e17016770a >/dev/null 2>&1
      5. So I checked
      6. /var/lib/openmediavault/cron.d/rsync-fcc54383-1496-4715-8ca7-d1e17016770a
      7. it contains
      8. #!/bin/sh
      9. # This configuration file is auto-generated.
      10. # WARNING: Do not edit this file, your changes will be lost.
      11. . /usr/share/openmediavault/scripts/helper-functions
      12. cleanup() {
      13. omv_kill_children $$
      14. rm -f /var/run/rsync-fcc54383-1496-4715-8ca7-d1e17016770a
      15. exit
      16. }
      17. [ -e /var/run/rsync-fcc54383-1496-4715-8ca7-d1e17016770a ] && exit 1
      18. if ! omv_is_mounted "/srv/dev-disk-by-label-BK01" ; then
      19. omv_error "Destination storage device not mounted at </srv/dev-disk-by-label-BK01>!"
      20. exit 1
      21. fi
      22. trap cleanup 0 1 2 5 15
      23. touch /var/run/rsync-fcc54383-1496-4715-8ca7-d1e17016770a
      24. omv_log "Please wait, syncing <root@libreelec:/var/media/INTENSO/Fotos> to </srv/dev-disk-by-label-BK01/Backup/libreelec> ...\n"
      25. export RSYNC_PASSWORD="le"
      26. rsync --verbose --log-file="/var/log/rsync.log" --recursive --times --archive --perms --rsync-path=/storage/.kodi/addons/virtual.network-tools/bin/rsync 'root@libreelec:/var/media/INTENSO/Fotos' '/srv/dev-disk-by-label-BK01/Backup/libreelec' & wait $!
      27. omv_log "\nThe synchronisation has completed successfully."
      Display All

      So I executed this rsync command (line 30) in bash:

      Source Code

      1. root@ser03:/# rsync --verbose --log-file="/var/log/rsync.log" --recursive --times --archive --perms --rsync-path=/storage/.kodi/addons/virtual.network-tools/bin/rsync 'root@libreelec:/var/media/INTENSO/Fotos' '/srv/dev-disk-by-label-BK01/Backup/libreelec'
      2. root@libreelec's password: <<<<<<!!!!
      3. receiving incremental file list
      4. Fotos/
      5. Fotos/Rxxx/
      6. Fotos/Rxxx/BILD_20190510_124331.jpg
      7. Fotos/Rxxx/BILD_20190510_124351.jpg
      8. Fotos/Rxxx/BILD_20190510_181340.jpg
      9. Fotos/Rxxx/BILD_20190511_154252.jpg
      10. [...]
      11. Fotos/Rxxx/IMG_20190515_143229.jpg
      12. Fotos/Rxxx/IMG_20190515_215323.jpg
      13. Fotos/Rxxx/.stfolder/
      14. sent 1,067 bytes received 128,134,513 bytes 7,765,792.73 bytes/sec
      15. total size is 509,458,608 speedup is 3.98
      Display All
      the rsync command works (here with password (line 2)).

      My thesis:
      rsync may fail due to login issue on libreelec.

      So I configured passwordless login:

      (public key already exists already on OMV, so I just copied public key to remote device "libreelec"):

      Source Code

      1. # ssh-copy-id -i ~/.ssh/id_rsa.pub libreelec
      2. /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
      3. /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
      4. /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
      5. root@libreelec's password:
      6. Number of key(s) added: 1
      7. Now try logging into the machine, with: "ssh 'libreelec'"
      8. and check to make sure that only the key(s) you wanted were added.

      and it works with ssh:

      Source Code

      1. root@ser03:/# ssh libreelec
      2. ##############################################
      3. # LibreELEC #
      4. # http://libreelec.tv #
      5. ##############################################
      6. LibreELEC (wrxtasy-raybuntu-media_build) Version: 8.0

      Now the rsync command works in bash without PW:

      Source Code

      1. root@ser03:/# rsync --verbose --log-file="/var/log/rsync.log" --recursive --times --archive --perms --rsync-path=/storage/.kodi/addons/virtual.network-tools/bin/rsync 'root@libreelec:/var/media/INTENSO/Fotos' '/srv/dev-disk-by-label-BK01/Backup/libreelec'
      2. receiving incremental file list
      3. Fotos/Rxxx/
      4. Fotos/Rxxx/BILD_20190524_073950.jpg
      5. sent 55 bytes received 3,488,304 bytes 2,325,572.67 bytes/sec
      6. total size is 512,942,451 speedup is 147.04

      Final test: what if I execute the rsync job in OMV web gui (did not change the settings):

      Source Code

      1. Please wait, syncing <root@libreelec:/var/media/INTENSO/Fotos> to </srv/dev-disk-by-label-BK01/Backup/libreelec> ...
      2. receiving incremental file list
      3. Fotos/Rxxx/
      4. Fotos/Rxxx/BILD_20190524_074912.jpg
      5. sent 55 bytes received 4,798,082 bytes 3,198,758.00 bytes/sec
      6. total size is 517,735,734 speedup is 107.90
      7. The synchronisation has completed successfully.
      8. Fertig ...
      Display All
      :thumbsup:

      Conclusion:
      rsync works in my case only with public key authentication even the rsync job is set up with password authentication.

      The post was edited 3 times, last by Newtren ().

    • Glad you found a solution :) I too set up my rsync job using keys as opposed to passwords, which took a min to set up but works flawlessly.

      A side question if you don't mind, can you modify the content of the destination folder over SMB? Because on mine, as soon as a rsync job is run, the destination folder becomes sorta "read-only" when working with SMB... makes me wonder whether this is the correct behavior.

      Cheers.