0

I have done setting up a squid proxy server with username and password. It authenticates when opening browser for username and password. It works great in browsers. But in terminal, i want to access the commands using proxy server. Instead of exporting proxy setting to the system file, I want to access it with the proxy url.

http://username:password@proxyhost:3128 sudo apt-get update

How can i do that. I want this for further processing in my python program

1 Answer 1

0

The proxy is a web proxy, so will not proxy your ssh commands.

ssh has the concept of a proxy (different from a web proxy).

In your .ssh/config you put

Host target
    ProxyCommand ssh proxyhost -W %h:%p

This means that when you 'ssh target' it will actually ssh via the proxyhost and then ssh to the target.

The %h and %p represent the target host and port respectively.

Here is a good article describing the details: https://www.cyberciti.biz/faq/linux-unix-ssh-proxycommand-passing-through-one-host-gateway-server/

2
  • I am not using ssh commands. The username and password is the authentication to enter through Squid Proxy Server. Commented Mar 6, 2019 at 4:45
  • The 'sudo apt-get update' is a command line operation - you need to use ssh, or similar, to connect to the machine to run stuff on the command line. You can use squid to proxy ssh (squins.com/knowledge/squid-http-https-ssh-proxy) but you still need to use ssh
    – dwagon
    Commented Mar 6, 2019 at 5:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .