Why sudo -i
command is not setting the TERM, PATH, HOME, SHELL, LOGNAME, USER and USERNAME on my fresh Ubuntu 12.04.1 LTS as decribed in the manual?
# sudo -u johnny -i echo $HOME && echo $USER
/root
root
Using -H
is not setting $HOME either. And my user does exist with a home :
# cat /etc/passwd
[..]
johnny:x:1000:1000::/home/johnny:/bin/bash
Update : Why am I having this issue? Because I am trying to create an ubuntu upstart job for multiple unicorn applications & I am using user installation of RVM + Bundle : without $HOME being properly evaluated, RVM do not find ~/.rvm.
sudo -E -u johnny echo $HOME && sudo -E -u johnny echo $USER
would've worked for you.