How do I get sudo - u $customer to make use of the customers env?

It appears when sudoing down that making use of sudo -u $user that the setting of origin is still being made use of. Just how can I make sudo make use of the customers setting? as an unique note not all customers that I will certainly be utilizing this on have login coverings.

0
2019-05-13 05:52:07
Source Share
Answers: 2

man sudoers on Debian states an additional opportunity. Not exactly sure which means around you desire, yet your inquiry seems like you would certainly intend to have the env_reset alternative from /etc/sudoers - the reverse is primarily the env_keep checklist. In order to set the correct HOME you can make use of the -H alternative to sudo straight or, once more in sudoers, with the always_set_home alternative.

Conversely you can make use of env_file to define an specific setting you intend to pass. Nonetheless, I assume it is ideal if you look into the env_* alternatives from man sudoers, due to the fact that /etc/sudoers regulates all of it which is the indicate resort to.

Below becomes part of the context in which I make use of env_reset inside my sudoers documents :

Defaults        !lecture
Defaults        env_reset
Defaults        syslog=auth
Defaults        log_year
0
2019-12-03 03:30:59
Source

Try sudo -i -u $user

[email protected]:~$ env |grep HOME
HOME=/home/gerald
[email protected]:~$ sudo -u ubuntu env |grep HOME
HOME=/home/gerald
[email protected]:~$ sudo -i -u ubuntu env |grep HOME
HOME=/home/ubuntu
0
2019-05-17 20:10:38
Source