If am using ifplugd to monitor a LAN connection on an ubuntu 20.04 system which is acting as a router in addition to other things. When a cable is plugged in to LAN I want to launch a VPN session. I have been playing around with ifplugd and need to lauch a simple script to start protonvpn-cli to connect to a vpn server.
protonvpn-cli or a simple script containing it should run as regular user but it always executes as root.
I found this post very informative and thought the answers from @dessert were my answer too but it didn't work.
…
echo "Trying sudo -u meteor bash"
sudo -u meteor bash -c '\
echo "$ whoami" && whoami && echo "^^^^^^ meteor expected"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh |\
bash
'
echo "ls -al /home/meteor/.nvm # should be populated"
…
For my situation I included the whoami output so I could see the non-root user was printed, but when protonvpn-cli executed it still warned me I was running as root user.
sudo -u regularuser bash -c 'whoami && "protonvpn-cli c -f" '
What am I doing wrong? I tried both methods in the referenced post above and they both behaved the same - whoami in the bash returns the regular user name but the protonvpn-cli executing returns the warning that I am running as root.
protonvpn-cli
a shell script? if so, can you take a look inside to see how the test is implemented? – steeldriver Sep 12 '22 at 22:27