Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

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.