Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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/
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

marked as duplicate by Florian Diesch, jokerdino Dec 3 '13 at 15:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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
sudo -i also works. – elmicha Sep 26 '11 at 17:39
@AleksandrDubinsky sudo su without the hyphen (not an en-dash or em-dash; that could break things) does not execute /etc/profile, which does not answer OP's question – Doktor J Jul 8 at 17:49

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