Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I set global environment variables in Ubuntu, in such a way, that they would apply also to root user?

Setting PATH or JAVA_HOME in /etc/environment
or in /etc/profile.d/my_settings.sh
both works for usual user, but not for root.

I'm logging in as root using sudo bash or sudo zsh.

NOTE: using Ubuntu 10.04.

share|improve this question

1 Answer

You will need to get into a real root login shell:

sudo su -
share|improve this answer
I get an error: "Sorry, user [...] is not allowed to execute '/bin/su' as root on [...]" – Ivivi Vavava Sep 26 '11 at 10:37
Have you used sudo before su? – enzotib Sep 26 '11 at 16:47
1  
sudo -i also works. – elmicha Sep 26 '11 at 17:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.