sudo -i not behaving as expected

Posted by jpdoyle on Server Fault See other posts from Server Fault or by jpdoyle
Published on 2012-09-23T00:11:20Z Indexed on 2012/09/23 3:39 UTC
Read the original article Hit count: 567

Filed under:
|

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.

© Server Fault or respective owner

Related posts about sudo

Related posts about ubuntu-12.04