From 5fdaabdaf408ab9289fa595f31f0b450dfcfd67a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 13 Jun 2017 22:29:08 +0100 Subject: [PATCH] Settinsg syncthing permissions --- src/freedombone-syncthing | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/freedombone-syncthing b/src/freedombone-syncthing index 205584a7..402a1bab 100755 --- a/src/freedombone-syncthing +++ b/src/freedombone-syncthing @@ -302,10 +302,25 @@ function user_devices_changed { done } +function syncthing_set_permissions { + for d in /home/*/ ; do + USERNAME=$(echo "$d" | awk -F '/' '{print $3}') + if [ -d /home/$USERNAME/Sync ]; then + chown $USERNAME:$USERNAME /home/$USERNAME /home/$USERNAME/Sync + fi + if [ -d /home/$USERNAME/SyncShared ]; then + chown $USERNAME:$USERNAME /home/$USERNAME /home/$USERNAME/SyncShared + fi + done +} + user_devices_changed if [ $CHANGED ]; then create_syncthing_config + syncthing_set_permissions systemctl restart syncthing +else + syncthing_set_permissions fi exit 0