Posts

Showing posts with the label environment variable

-E option to export environment variable to sudoer

Have you ever faced a problem adding ppa (Personal Package Archive) in your computer. If you are getting error like Please check your internet connection then probably the reason is sudo is not able to find proxy setting. This may happen if proxy is only set to .profile or .bashrc file. So to overcome this problem I have already wrote one post before. Here I am showing another option which is bit easier option. Here you have to add -E while running sudo (note: E is in capital letter). So -E option actually preserve the environment option . See the Sudo Manual for more detail. So to add ppa run the following command sudo -E add-apt-repository ppa:<paa_name> This should work now. Cheers APaul Source http://askubuntu.com/questions/212132/i-cant-add-ppa-repository-behind-the-proxy http://www.sudo.ws/sudo/man/sudo.html http://apurbapaul.blogspot.in/2012/09/adding-repository-behind-proxy-using.html

Adding Defaults env_keep in visudo

Image
In my previous two blog I have discussed problem with add-apt-repository behind proxy and x-server problem with sudo command. In both cases solution was to add Defaults env_keep in sudoer's file. like Defaults env_keep=" DISPLAY XAUTHORITY" (for gedit) Defaults env_keep="http_porxy" (for adding repository) Problem is, if you add line like above, one that is las line work. Because above command actually keep envs that at the last line and reset all others. To add more than one env variable you can use any of the following methods. First method: You can specify, as many env variable as you want, in side the quote, separated by space. For example: Defaults env_keep="http_proxy ftp_proxy DSPLAY XAUTHORITY" Second Method: You can use "+=" sign instead of "=" sign in the command. For example: Defaults env_keep+="DSPLAY XAUTHORITY" Defaults env_keep+="http_proxy" Both are equally good method. You c...

Setting http_proxy value to local bashrc file

When I connect my laptop to internet from my institute I had to connect it through proxy. But when I connect it from my room I have to connect it directly. So I have to change my proxy frequently. But I have observed that changing proxy through network manager does not actually change the value of "http_proxy" variable. Neither the export command actually work. So we have changed the value by changing the ~/.bashrc file and adding the proxy value. Use the following command to edit file. $gedit ~/.bashrc Then add the following line http_proxy="http://userid:pass_word@proxy:port/" https_porxy="https://userid:pass_word@proxy:port/" ftp_proxy="ftp://userid:pass_word@proxy:port/" You can also set the domain which should not use proxy by no_proxy environment variable. This will be coma separated string containing domain name. Like no_proxy="first.domain,secon.domain" you can also edit some other file like /etc/environment /etc/bash...