Settinsg syncthing permissions

This commit is contained in:
Bob Mottram 2017-06-13 22:29:08 +01:00
parent ca6420f123
commit 5fdaabdaf4
1 changed files with 15 additions and 0 deletions

View File

@ -302,10 +302,25 @@ function user_devices_changed {
done 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 user_devices_changed
if [ $CHANGED ]; then if [ $CHANGED ]; then
create_syncthing_config create_syncthing_config
syncthing_set_permissions
systemctl restart syncthing systemctl restart syncthing
else
syncthing_set_permissions
fi fi
exit 0 exit 0