Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Not sure what info you need here, if any. Just let me know. I have a proxy that bypasses the corporate net set in my profile file for both su and normal user. When I do a sudo or regular apt-get install as a normal user, it hangs as if it can't communicate out, I have inter-web access though. When I do the same apt-get as a su, it works, no problem. What you think ?

share|improve this question
    
Interesting. My first guess is that sudo is not grabbing the full login profile of root, and therefore does not pickup the proper proxy configuration. When you su and apt-get as separate operations it works, however? Here are some other things to try: 'su' vs 'su -': is there a difference? –  David Paigen Dec 7 '12 at 18:07
add comment

1 Answer

up vote 3 down vote accepted

It seems to be related with environment variables.

If you set the proxy in your profile (as environment variables), then probably when issuing sudo, these variables don't get loaded.

If you succeed doing so with su, then probably you're using su - (that's the way to load the environment variables of root).

To get loaded these variables (for a normal user) —if my assumptions are right— you should use the option -E of sudo. You should see the manual of sudo for further details.

share|improve this answer
    
no sure what 'su -' is would I be explicitly typing that into command line ? –  ebel Dec 7 '12 at 21:03
    
Aren't you issuing su -? If you are using just su, then I don't know why apt-get knows the proxy environment variable. How did you setup the proxy? –  nozimica Dec 7 '12 at 21:20
    
I am changing user to su, then doing apt-get install XXX –  ebel Dec 7 '12 at 21:23
    
What is the syntaxis you're using to set the proxy? –  nozimica Dec 7 '12 at 21:39
1  
Try doing sudo -E apt-get install ... and tell us what happens. –  nozimica Dec 7 '12 at 22:24
show 2 more comments

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.