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.
No comments:
Post a Comment