sudo rsync -rav -e 'ssh -p 5152'
In deinem Fall zwingst du den rsync mit dem Argument "-e" eine remote shell für die Verbindung zu verwenden
-e, --rsh=COMMAND specify the remote shell to use
Um die Umgebungsvariable RSYNC_PASSWORD verwenden zu können, muss man die Verbindung zu einem rsync daemon direkt aufbauen. D.h. die Verwendung in Kombination mit der remote shell -e "ssh" ist so nicht möglich.
In der Hilfe ist das mit dem Password nicht gang eindeutig erklärt.
Eigentlich schon...
Siehe die Dokumentation zu
rsync:
RSYNC_PASSWORD
Setting RSYNC_PASSWORD to the required password allows you to run authenticated rsync connections to an rsync daemon without user intervention. Note that this does not supply a password to a remote shell transport such as ssh; to learn how to do that, consult the remote shell's documentation.
Das gleiche gilt auch für die Option
--password-file falls man das Passwort lieber in einer Datei ablegen möchte.
--password-file
This option allows you to provide a password in a file for accessing an rsync daemon. The file must not be world readable. It should contain just the password as a single line. This option does not supply a password to a remote shell transport such as ssh; to learn how to do that, consult the remote shell's documentation. When accessing an rsync daemon using a remote shell as the transport, this option only comes into effect after the remote shell finishes its authentication (i.e. if you have also specified a password in the daemon's config file).
Jetzt sehe ich in deiner Situation 2 Möglichkeiten:
a.) Du verwendest den rsync daemon und somit ohne die Verbindung über eine remote shell aufzubauen
b.) Du erstellst dir ein Schlüsselpaar mit ssh-keygen ohne ein Passwort und platzierst den public key (~/.ssh/authorized_keys) auf dem entfernten System und den private key auf dem lokalen System (~/.ssh) und machst die Verbindung wie gewünscht über rsync und remote shell.
Dann eben mit der zusätzlichen Angabe auch des private keys:
-e 'ssh -p 5152 -i ~/.ssh/private_key_rsa'
Wie man ein Schlüsselpaar erstellt und jeweils den öffentlichen und den privaten Schlüssel platziert und die Rechte richtig setzt gibt es unzählige Anleitungen im Netz zu finden worauf ich hier nicht explizit eingehen möchte.