Rsync - Connection refused on different port than 22

    • OMV 3.x
    • Resolved

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

    • No, not this one.

      The /etc/ssh/ssd_config on the web server (the destination) must conatin something like:

      Shell-Script

      1. # Package generated configuration file
      2. # See the sshd_config(5) manpage for details
      3. # What ports, IPs and protocols we listen for
      4. Port 22
      5. Port 22445
      6. # Use these options to restrict which interfaces/protocols sshd will bind to
      7. #ListenAddress ::
      8. #ListenAddress 0.0.0.0
      9. Protocol 2

      Just added the line 6 (Port 22455) on my own server for a test and could connect with ssh -p 22445 <my user><at><my server>.

      The post was edited 1 time, last by chris789 ().

    • Here it is,

      Source Code

      1. # What ports, IPs and protocols we listen for
      2. Port 22445
      3. # Use these options to restrict which interfaces/protocols sshd will bind to
      4. Protocol 2
      5. # HostKeys for protocol version 2
      6. HostKey /etc/ssh/ssh_host_rsa_key
      7. HostKey /etc/ssh/ssh_host_dsa_key
      8. HostKey /etc/ssh/ssh_host_ecdsa_key
      9. HostKey /etc/ssh/ssh_host_ed25519_key
      10. #Privilege Separation is turned on for security
      11. UsePrivilegeSeparation yes
      12. # Lifetime and size of ephemeral version 1 server key
      13. KeyRegenerationInterval 3600
      14. ServerKeyBits 2048
      15. # Logging
      16. SyslogFacility AUTH
      17. LogLevel INFO
      18. # Authentication:
      19. LoginGraceTime 120
      20. PermitRootLogin no
      21. StrictModes yes
      22. RSAAuthentication yes
      23. PubkeyAuthentication yes
      24. AuthorizedKeysFile %h/.ssh/authorized_keys
      25. # Don't read the user's ~/.rhosts and ~/.shosts files
      26. IgnoreRhosts yes
      27. # For this to work you will also need host keys in /etc/ssh_known_hosts
      28. RhostsRSAAuthentication no
      29. # similar for protocol version 2
      30. HostbasedAuthentication no
      31. # To enable empty passwords, change to yes (NOT RECOMMENDED)
      32. PermitEmptyPasswords no
      33. # Change to yes to enable challenge-response passwords (beware issues with
      34. # some PAM modules and threads)
      35. ChallengeResponseAuthentication no
      36. # Change to no to disable tunnelled clear text passwords
      37. PasswordAuthentication no
      38. X11Forwarding no
      39. X11DisplayOffset 10
      40. PrintMotd no
      41. PrintLastLog yes
      42. TCPKeepAlive yes
      43. ClientAliveInterval 180
      44. ClientAliveCountMax 0
      45. # Allow client to pass locale environment variables
      46. AcceptEnv LANG LC_*
      47. Subsystem sftp /usr/lib/openssh/sftp-server
      48. UsePAM yes
      49. AllowUsers XXXXX
      Display All
      "Given enough eyeballs, all bugs are shallow"
      ESR.
    • I can copy, synchronize files via terminal and rsync command without any problems:

      Source Code

      1. rsync -avz -e "ssh -p 22445" me@10.0.0.3:/var/www/ /tmp/test/
      I can not do that via OMV's interface and rsync task. Apparently there's a bug with SSH Port setting, at least in this particular case.

      I found simple workaround. I've opened rsync task for edit and in Extra options field added:
      -e "ssh -p 22445"
      That line resolved my problem.

      Anyway thanks subzero79 and chris789.
      Respect !

      "Given enough eyeballs, all bugs are shallow"
      ESR.
    • I don't mind:

      Shell-Script

      1. !/bin/sh
      2. # This configuration file is auto-generated.
      3. # WARNING: Do not edit this file, your changes will be lost.
      4. . /usr/share/openmediavault/scripts/helper-functions
      5. cleanup() {
      6. omv_kill_children $$
      7. rm -f /var/run/rsync-1c254254-5487-5aa2-273f-e8547a547877
      8. exit
      9. }
      10. [ -e /var/run/rsync-1c254254-5487-5aa2-273f-e8547a547877 ] && exit 1
      11. if ! omv_is_mounted "/srv/dev-disk-by-label-bpi-bck" ; then
      12. echo "Destination storage device not mounted at </srv/dev-disk-by-label-bpi-bck>!"
      13. exit 1
      14. fi
      15. trap cleanup 0 1 2 5 15
      16. touch /var/run/rsync-1c254254-5487-5aa2-273f-e8547a547877
      17. echo "Please wait, syncing <me@10.0.0.3:/home> to </srv/dev-disk-by-label-bpi-bck/backups/webserver> ...\n"
      18. eval $(ssh-agent) >/dev/null
      19. ssh-add /etc/ssh/openmediavault-ca5471b0-a241-4ccb-a7c4-532v45gfd87s >/dev/null
      20. rsync --verbose --log-file="/var/log/rsync.log" --rsh "ssh -p 22445" --recursive --times --compress --archive --perms --partial 'me@10.0.0.3:/home' '/srv/dev-disk-by-label-bpi-bck/backups/webserver' & wait $!
      Display All
      "Given enough eyeballs, all bugs are shallow"
      ESR.
    • Something I've seen in the script: Between --rsh and "ssh -p ..." is a missing '='. If you add the -e before the "ssh -p ..." you get the same as with ---rsh=ssh -p ... . Think the missing '=' is the problem.

      Cannot test how to get the correct syntax in the script because my OMV is 2.x and I use rsync as part of a bigger (self scripted) backup solution and not the plugin.
    • chris789 wrote:

      Something I've seen in the script: Between --rsh and "ssh -p ..." is a missing '='. If you add the -e before the "ssh -p ..." you get the same as with ---rsh=ssh -p ... . Think the missing '=' is the problem.

      The manual indicates as you point, but i have a similar pull setup using a remote public server also using a different port and it works as expected using --rsh "ssh -p 2000" . I have no idea why is defaulting to port 22 in this case
      chat support at #openmediavault@freenode IRC | Spanish & English | GMT+10
      telegram.me/openmediavault broadcast channel
      openmediavault discord server