How do I use a proxy which contains a user and password?

Solution 1:

If you want to set this for all users on the system edit

sudo nano /etc/environment

and add

export HTTP_PROXY="{user}:{pwd}@{proxy--address}:{port}"
export HTTPS_PROXY="{user}:{pwd}@{proxy--address}:{port}"
export FTP_PROXY"{user}:{pwd}@{proxy--address}:{port}"
export NO_PROXY="localhost,127.0.0.1,::1"

If you want it for a single user you can put those lines in

sudo nano ~/.bashrc

That method allows for a different proxy for each user. If you need a proxy for apt:

sudo nano /etc/apt/apt.conf

and add

Acquire::http::Proxy "http://{user}:{pwd}@ {proxy-address}:{port}";
Acquire::https::Proxy "http://{user}:{pwd}@ {proxy-address}:{port}";