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

To add :/usr/local/go/bin to the PATH with Ubuntu 10.04 LTS (Lucid) and permanently change the PATH, I just edited the files /etc/environment and /etc/login.defs.

And these modifications were OK both for my current user account and my root account.

i.e. echo $PATH returned the modified PATH for my user account as well as for the root account when using sudo -i or su.

However, this doesn't work anymore with Ubuntu 12.04 LTS when doing the same modifications if using sudo -i!

Meanwhile, this works when using su!

What should I explicitly modify to get permanently that same behavior with Precise Pangolin when using sudo -i?

share|improve this question

sudo -i is supposed to be a "safe" sudo. That means that it ignores any changes to path such that it is restricted to managed programs.

Use sudo -s instead if you want to load /etc/environment instead of using sudo -i.

See also:

share|improve this answer
Thank you so much for all the information and links. However, goodeling a pair of hours, I also found that if I modify the line secure_path of the /etc/sudoers file (using visudo) I will get the requested modified PATH when using both sudo, sudo -i and su. BTW, thank you again for your advice. Cheers. Fnux. – Fnux Feb 27 '13 at 1:38

Your Answer


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.