Right, this is mentioned in the manpage. You can force environment
to be cleared by passing --clear-env. Actually setting HOME to what
a login shell would do would require lxc-attach to make assumptions
about the container. However you can
lxc-attach -n trusty-vimprobable --clear-env -- su - ro
Public bug reported:
I have lxc containers set up as an unprivileged user.
When I start my containers, the root user has the $HOME environmental
variable set, pointing at the unprivileged user.
This is the faulty session:
sputnik is the host, lamp2 is the lxc container
ruben@sputnik:~$ echo $H