I'm setting up a Vagrant box and I noticed something I found odd.
root@box:~# sudo --user=vagrant bash bash: /root/.bashrc: Permission denied vagrant@box:~$ export declare -x HOME="/root"
HOME set to
/root here? The home directory for the user vagrant is certainly not
vagrant@box:~$ grep vagrant /etc/passwd vagrant:x:1000:1000::/home/vagrant:/bin/bash
Everything I found online talked about how to inherit environment variables, not how to prevent it. The sudoers file contains the
env_reset default. I don't know what else controls this behavior.