From e3c640eae010af57dcebab4ea679703c94fe1861 Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 7 Feb 2022 13:54:44 -0700 Subject: [PATCH] Modify sudo such that wrolpi user can run two commands without password. --- install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/install.sh b/install.sh index 17d15b3a..57259850 100755 --- a/install.sh +++ b/install.sh @@ -84,6 +84,13 @@ cp /opt/wrolpi/50x.html /var/www/50x.html grep wrolpi /etc/passwd || useradd -md /home/wrolpi wrolpi -s "$(command -v bash)" chown -R wrolpi:wrolpi /opt/wrolpi +# Give WROLPi user a few privileged commands via sudo without password. +cat > /etc/sudoers.d/90-wrolpi << 'EOF' +%wrolpi ALL=(ALL) NOPASSWD:/usr/bin/nmcli,/usr/bin/cpufreq-set +EOF +# Verify this new file is valid. +visudo -c -f /etc/sudoers.d/90-wrolpi + # Create the media directory. This should be mounted by the maintainer. [ -d /media/wrolpi ] || mkdir /media/wrolpi chown -R wrolpi:wrolpi /media/wrolpi