Home > Linux > Export Proxy on Konsole/Terminal

Export Proxy on Konsole/Terminal

February 25th, 2008 Leave a comment Go to comments

If you are under a proxy server, and want to access net using http or ftp through Konsole/Terminal, you will need to export http_proxy/ftp_proxy variables. One simple way to do so is that you type the following 2 commands :

$export http_proxy="http://username:password@proxyserver:proxyport"
$export ftp_proxy="http://username:password@proxyserver:proxyport"

You will need to replace “username”, “password”, “proxyserver” and “proxyport” with appropriate values.

But this way, you will see your password as well. And if you are with your friends, they can see the password as well. To solve this problem, you can use this small script. In “/etc/bash.bashrc” append these lines :

function proxy(){
echo -n "username :"
read -e username
echo -n "password :"
read -es password
export http_proxy="http://$username:$password@proxyserver:proxyport/"
export ftp_proxy="http://$username:$password@proxyserver:proxyport/"
echo -e "\nProxy variables set."
}

You will need to replace “proxyserver” and “proxyport” with appropriate values. Thats it. Now whenever you need to export the variables, just type “proxy” and press enter. It will ask you for your username and passwd. And will do the rest by itself.

Categories: Linux Tags:
  1. February 25th, 2008 at 09:07 | #1

    Or u can run squid on ur comp, and only export localhost:3128 in bashrc. in squid.conf u’d have to provide the proxy servers (and username, passwd). chmod 600 your squid.conf so that only root can see its content.

  2. February 25th, 2008 at 09:21 | #2

    dude, btw i thought u weren’t using any of google’s services. why the hell have u put google ads??? those were the first and easiest things to remove, right?

  3. rohitj
    February 25th, 2008 at 11:46 | #3

    Squid : Well, thats a bulky task. And as far I have heard, its difficult to manage.

    Google : I wrote a post about it, I will soon remove it. Its for testing purpose only (its a plan, which I will disclose on appropriate time). :)

  4. February 25th, 2008 at 11:51 | #4

    manage? :O squid? :O. And it’s not a bulky task. apt-get install squid. was that bulky?

    just copy the conf from someone and u’re done. i suppose typing export blah blah on the console or entering passwd everytime is what u’d call “manage”

    about google: so u are a hypocrite after all :|

  5. rohitj
    February 25th, 2008 at 18:26 | #5

    squid : how much time/talent does it take to write the conf file by yourself, well when I wrote this post, I wanted to consider all people behind proxy, not just IITians, who can copy the conf file from others.

    google : :) no explanations :)

  6. February 25th, 2008 at 18:32 | #6

    ah, if only there was a vast body of information where one could find sample config files. Oh wait, there is! It’s called the Net!

  1. No trackbacks yet.