From c5e3374f0608c6f02aade0f2a1bcffb61578e2b7 Mon Sep 17 00:00:00 2001 From: rleidner Date: Tue, 26 Nov 2024 11:55:35 +0100 Subject: [PATCH 1/2] soc_vwid: main.sh - always execute as user pi --- modules/soc_vwid/main.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/soc_vwid/main.sh b/modules/soc_vwid/main.sh index ea94b811d..1207576aa 100755 --- a/modules/soc_vwid/main.sh +++ b/modules/soc_vwid/main.sh @@ -1,4 +1,18 @@ #!/bin/bash + +# -- start user pi enforcement +# normally the soc module runs as user pi +# When LP Configuration is stored, it is run as user www-data +# This leads to various permission problems +# if actual user is not pi, this section restarts the script as user pi +usr=`id -nu` +if [ "$usr" != "pi" ] +then + sudo -u pi -c bash "$0 $*" + exit $? +fi +# -- ending user pi enforcement + OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd) RAMDISKDIR="$OPENWBBASEDIR/ramdisk" MODULEDIR=$(cd `dirname $0` && pwd) From ea5f306f615b187dbbdb064a566223ba7cda9612 Mon Sep 17 00:00:00 2001 From: rleidner Date: Tue, 26 Nov 2024 12:02:32 +0100 Subject: [PATCH 2/2] fix spaces to tabs --- modules/soc_vwid/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/soc_vwid/main.sh b/modules/soc_vwid/main.sh index 1207576aa..8269dddc6 100755 --- a/modules/soc_vwid/main.sh +++ b/modules/soc_vwid/main.sh @@ -8,8 +8,8 @@ usr=`id -nu` if [ "$usr" != "pi" ] then - sudo -u pi -c bash "$0 $*" - exit $? + sudo -u pi -c bash "$0 $*" + exit $? fi # -- ending user pi enforcement