Monday, May 21, 2012

How To Set Proxy in Ubuntu terminal

If you are under a proxy server, and want to access net using http or ftp through Terminal,you will need to export http_proxy/ftp_proxy variables. 
 For a HTTP proxy, simply run the following command in a terminal
  •  export http_proxy='http://proxy_username:password@proxy_ip:port " 
For a HTTPs and FTP 
  •  export https_proxy=https://proxy_username:password@proxy_ip:port 
  •  export ftp_proxy=ftp://proxy_username:password@proxy_ip:port   
If there is no username and password required for your proxy then simply remove the username and password section. 

  • " export https_proxy=https://proxy_ip:port "
These settings are saved into  /etc/apt/apt.conf file .So you can directly add these variables using text editor .First open the apt.conf file
  • " sudo gedit /etc/apt/apt.conf "
then enter the username,password,proxy_ip and port in given format
  •  Acquire::http::proxy "http://proxy_username:password@proxy_ip:port ";
  •  Acquire::https::proxy "https://proxy_username:password@proxy_ip:port" ;
  •  Acquire::ftp::proxy "ftp://proxy_username:password@proxy_ip:port ";

Enjoy !!!!

23 comments:

  1. -sudo gedit /etc/apt/apt/conf
    +sudo gedit /etc/apt/apt.conf

    ReplyDelete
  2. Nice it worked for me

    ReplyDelete
  3. How to add proxy_username like: abc\am2
    - abc is domain
    - am2 is username

    ReplyDelete
  4. Worked for me. Thank you so much for the insight.

    ReplyDelete
  5. hey how to disable proxy from terminal ?

    ReplyDelete
    Replies
    1. Clear the apt.conf file. Remove all the added settings.

      Delete
  6. thanks dude ! i was becoming too much irritated because of this problem ;now fixed

    ReplyDelete
  7. I m getting excited to get this way to access any blocked site. Now you can get by using this link
    Reddit UK proxy

    ReplyDelete
  8. Hi

    I seem to have formatted the C-drive while creating a partition for installing windows. Could you please help me to recover it. It has my entire data and unfortunately i do not even the backup.

    Regards
    Karishma

    ReplyDelete
    Replies
    1. If you have formatted your C drive, then there is no way to recover it. From next time, keep all your important data on cloud (Dropbox/SkyDrive).

      Delete
  9. I will recommend you very easy way to access any blocked site. It does not required any installation. Just click on this link and any block site will be open like a charm

    Reddit UK proxy

    ReplyDelete
  10. Dear Rahul Jain, thanks for your post. But I think the content of /etc/apt/apt.conf should be
    Acquire::http::proxy "http://proxy_username:password@proxy_ip:port ";
    Acquire::https::proxy "https://proxy_username:password@proxy_ip:port ;
    Acquire::ftp::proxy "ftp://proxy_username:password@proxy_ip:port ";

    instead of


    " Acquire::http::proxy "http://proxy_username:password@proxy_ip:port ";
    " Acquire::https::proxy "https://proxy_username:password@proxy_ip:port ;
    " Acquire::ftp::proxy "ftp://proxy_username:password@proxy_ip:port ";

    You have given and extra " in the beginning of each line, which will give the error "E: Syntax error /etc/apt/apt.conf:3: Extra junk at end of file". Thanks

    ReplyDelete
  11. In my post above there is a " missing in the end of second line

    ReplyDelete
  12. Hallo the quotation mark before Acquire has to be removed. And then it will work fine.

    thank you anyway.

    ReplyDelete
  13. Great! It works for me. Thanks a lot!

    ReplyDelete
  14. What a nice blog...I am really very impressed to read this..Thanks to admin for posting this nice blog....WOW!!!!!
    http://websiteproxy.co.uk/monova.org.html

    ReplyDelete
  15. But how to again remove it

    ReplyDelete
  16. I'm really impressed with your writing skills and also with the format on your weblog.
    access torrentHound in UK

    ReplyDelete
  17. Proxy sites help us in a lot of ways in our online time. The mainly significant is that a proxy site helps us to unblock or most favorite social site. 
    Mp3Raid UK proxy

    ReplyDelete