sceptre-phenix
sceptre-phenix copied to clipboard
Use /etc/phenix/store.bdb by default when root, even if root was obtained via sudo
Originally created by @activeshadow on Wed, 20 Jan 2021 18:06:02 GMT
Right now, phenix
checks to see if the SUDO_USER
env variable is set, and if so it uses the store local to that user. However, SUDO_USER
is set even when a user is currently root via sudo su
.
The hack way to get around this is to run su -
after running sudo su
, which unsets the SUDO_USER
env variable.
In the code, we should also check the SUDO_COMMAND
env variable and only use the store local to the SUDO_USER
if the command is for the phenix executable. When someone sudo's to root, the SUDO_COMMAND
will be set to something like /bin/su
.