diff --git a/src/freedombone-app-rsync b/src/freedombone-app-rsync
index 0ef027802ea3b0c1a3520bc5067e14f2e6b5d8d4..197db3e1951c500f5fbaf60d4b039dc9b12706be 100755
--- a/src/freedombone-app-rsync
+++ b/src/freedombone-app-rsync
@@ -44,7 +44,6 @@ NOT_ON_HOMEPAGE=1
 
 RSYNC_DOMAIN_NAME=
 RSYNC_CODE=
-RSYNC_ONION_PORT=9951
 RSYNC_PORT=873
 
 # These parameters are used by the FreedomBox mobile app and web UI
@@ -134,6 +133,11 @@ function remove_rsync {
     userdel -r rsync
     rm -rf "$RSYNC_DATA"
 
+    if grep -q "127.0.0.1:$RSYNC_PORT" "/etc/torrc.d/${PROJECT_NAME}"; then
+        sed -i "/127.0.0.1:$RSYNC_PORT/d" "/etc/torrc.d/${PROJECT_NAME}"
+        systemctl restart tor
+    fi
+
     remove_app rsync
     remove_completion_param install_rsync
     sed -i '/rsync/d' "$COMPLETION_FILE"
@@ -194,6 +198,11 @@ function install_rsync {
 
     increment_app_install_progress
 
+    if ! grep -q "127.0.0.1:$RSYNC_PORT" "/etc/torrc.d/${PROJECT_NAME}"; then
+        sed -i "/127.0.0.1:5783/a HiddenServicePort $RSYNC_PORT 127.0.0.1:$RSYNC_PORT" "/etc/torrc.d/${PROJECT_NAME}"
+        systemctl restart tor
+    fi
+
     systemctl enable rsync
     systemctl start rsync