How to Use Snap Behind a Proxy on Linux (Step-by-Step Guide) 

In this guide, you’ll learn how to configure Snap to work behind a proxy, even if you’re new to Linux or networking. 

Snap is a package management system developed by Canonical that simplifies the installation, update, and removal of applications on Linux systems. 

However, in corporate or academic environments, internet access is often routed through a proxy server, which can prevent Snap from functioning properly. 

Requirements 

Before starting, make sure you have: 

  • A computer running Ubuntu or another Linux distro that supports Snap 
  • The proxy settings (host, port, and credentials if required) 
  • Access to the terminal (Ctrl + Alt + T) 
  • sudo privileges 

If you’re unsure about the proxy details, contact your IT or network administrator. 

Step 1 – Get Your Proxy Information 

You’ll need the following details: 

  • Proxy address – e.g., 192.168.1.10 or proxy.youruniversity.edu 
  • Port – e.g., 3128 or 8080 
  • Username/password – if authentication is required 

How to find the proxy: 

  • Browser settings: Chrome and Firefox often show the proxy configuration in Settings > Network
  • Ask IT support: The most reliable way to get accurate info. 

Step 2 – Configuring Snap to Use a Proxy 

Snap uses a background service called snapd. To make it work with a proxy, you’ll need to use the snap set system command. 

If you haven’t installed the snap yet, use the command below to update the repositories and install the snap.

sudo apt update && sudo apt install snapd

Set an HTTP Proxy: 

To configure the proxy in the snap, we need to use the command below where we will include the proxy address and after the “:” we will include the proxy port.

sudo snap set system proxy.http=”http://<proxy_address>:<port>” 
 

Example: 

sudo snap set system proxy.http="http://172.16.0.1:3128" 
 

Set an HTTPS Proxy: 

Even for HTTPS connections, use the http:// prefix in the command: 

sudo snap set system proxy.https=”http://<proxy_address>:<port>” 

Example: 

sudo snap set system proxy.https="http://172.16.0.1:3128" 
 

Restart the service:

sudo systemctl restart snapd 

 

Proxy with Authentication: 

If credentials are required: 

sudo snap set system proxy.http=”http://username:password@<proxy_address>:<port>” 
sudo snap set system proxy.https=”http://username:password@<proxy_address>:<port>” 
 

Example:

 sudo snap set system proxy.http="http://maria:[email protected]:3128" 

*** Important: Be cautious when entering passwords directly in the terminal, especially on shared systems. 

Restart snapd: 

sudo systemctl restart snapd 

Step 3 – Verifying Proxy Configuration 

Check if the proxy settings were applied: 

sudo snap get system proxy 

You should see your proxy settings listed. If the output is empty or incorrect, repeat the steps above. 

Step 4 – Using Snap Commands Normally 

Once the proxy is configured, Snap will work as expected. For the following examples, we are assuming that we will install the firefox package.

Here are some basic commands: 

Search for packages: 

snap find <package_name>  

snap find firefox

Install a package: 

sudo snap install <package_name> 

sudo snap install firefox 

List installed packages: 

sudo snap list 

sudo snap list  

Update a package: 

sudo snap refresh <package_name> 

sudo snap refresh  firefox

Update all packages: 

sudo snap refresh  

Remove a package: 

sudo snap remove <package_name> 

sudo snap remove firefox 

Step 5 – Removing Proxy Settings (If Needed) 

To unset the proxy configuration: 

sudo snap unset system proxy.http 
sudo snap unset system proxy.https 
sudo snap unset system proxy.ftp 

sudo snap unset system proxy.http 
sudo snap unset system proxy.https 
sudo snap unset system proxy.ftp 
 

Then restart the service again: 

sudo systemctl restart snapd 
 

We can see with the command below that we have already removed the proxy configuration.

Conclusion 

Even in restricted environments like corporate or academic networks, Snap can be configured to work seamlessly behind a proxy. 

Now that you know how to set up Snap behind a proxy on Linux, you’ll be able to install and manage applications without internet access issues. 

Need help? Consult Snap’s official documentation or your institution’s IT support. 

See more:

apt get behind proxy

SquidGuard: how to import blocklist?

SquidGuard : Installation and Configuration

Proxy Squid: User Authentication

Squid Proxy: Filter clients by IP and MAC

Squid Proxy for Linux Installation and Configuration

Juliana Mascarenhas

Data Scientist and Master in Computer Modeling by LNCC.
Computer Engineer