How to secure a Linux laptop on public Wi-Fi networks
Using a Linux laptop in a coffee shop, airport, hotel, or coworking space is a practical solution for mobile users. However, these public Wi-Fi networks can pose a major risk to data privacy. Attackers can monitor traffic, create fake networks that mimic legitimate hotspots, or try to exploit exposed system services.
Unlike Windows and macOS, many Linux distributions do not automatically activate a special profile for public networks. The user must manually configure protection measures to reduce the attack surface.
This guide explains the most important methods for securing a Linux laptop connected to public Wi-Fi.
Main risks of using a Linux laptop on public Wi-Fi networks
A public wireless network should not be implicitly considered secure. Even if the password is provided by the coffee shop or hotel, the user does not control the network infrastructure.
The most common threats include:
- Network traffic interception – attackers may try to observe connections or traffic metadata.
- Fake Wi-Fi networks (“evil twin”) – a hotspot created to mimic a known network and attract users.
- Scanning active services – applications that accept external connections can become attack points.
- Physical access to the laptop – loss or theft of the device can expose personal files if the disk is not encrypted.
A well-configured Linux system can provide a high level of security but requires some manual adjustments.
Disable unnecessary Linux services
An important first step is to stop unnecessary network services, as these can become access points for attackers.
You can check active services using the terminal (depending on the distribution and installed applications):
sudo ss -tulpn | grep -E '(LISTEN|UNCONN)'
or
sudo lsof -i -P -n | grep LISTEN
This command displays ports and processes that accept connections. If you don’t need certain services while traveling, it’s recommended to temporarily stop them.
Examples of services that can be disabled:
- SSH – if the laptop is not used as a remotely administered server.
- Samba (smbd/nmbd) – for network file sharing.
- Avahi daemon – for automatic discovery of local devices and services.
- CUPS – if you are not using network printers.
To stop a service:
sudo systemctl stop "service_name"
This approach limits the possibilities of an attacker connected to the same Wi-Fi network.
If you use public Wi-Fi networks, use a trusted VPN
A VPN (Virtual Private Network) creates an encrypted tunnel between your laptop and the VPN server. This protects sensitive traffic before it leaves your device.
A VPN is especially recommended when:
- you use internet banking;
- you work with confidential documents;
- you access professional accounts;
- you use unknown Wi-Fi networks.
Many VPN services offer dedicated applications for Linux or OpenVPN configurations compatible with most distributions.
It is important to note that a VPN does not replace all security measures. It protects network traffic but does not prevent malware, physical device theft, or compromised passwords.
For more security on public Wi-Fi networks, use a firewall
Most modern Linux distributions include system-level firewall support through netfilter, a component integrated into the Linux kernel. However, the configuration interface differs from one distribution to another.
UFW (Uncomplicated Firewall) is one of the most popular tools for simplified firewall configuration, especially used in the Debian/Ubuntu ecosystem. It is included by default or quickly available in distributions such as:
- Ubuntu – UFW is commonly installed and can be activated directly;
- Linux Mint – includes UFW support, recommended for desktop users;
- Debian – UFW can be installed from official sources, but is not automatically activated;
- Pop!_OS – based on Ubuntu, allows the use of UFW;
- Kubuntu, Xubuntu, and other Ubuntu derivatives – support UFW through available packages.
Other Linux distributions use different tools:
- Fedora Linux, Red Hat Enterprise Linux, and compatible distributions primarily use firewalld;
- Arch Linux offers support for multiple solutions, including nftables, iptables, and firewalld, but configuration is left more to the user;
- openSUSE typically uses firewalld or other SUSE Firewall-based configurations.
On a laptop used on public Wi-Fi networks, the main goal is not the chosen tool, but the security policy applied: blocking externally initiated connections and allowing only necessary traffic.
For Ubuntu users and derived distributions, a minimal configuration can be:
On distributions like Ubuntu, UFW (Uncomplicated Firewall) can be activated as follows:
sudo ufw enable
To check the status:
sudo ufw status
A common configuration for a personal laptop is:
sudo ufw default deny incoming
sudo ufw default allow outgoing
This blocks connections initiated to the laptop while allowing normal internet browsing.
Configure your browser for more privacy
The browser is one of the main interfaces through which data circulates online.
For Linux users, Firefox can be configured for additional security by:
- activating DNS over HTTPS (DoH);
- blocking trackers;
- using automatic updates;
- installing known security extensions.
DNS over HTTPS prevents simple exposure of DNS requests to people monitoring the same network.
Enable disk encryption and automatic screen locking
Security is not just about protecting the internet connection. The laptop itself must be protected.
Essential recommendations:
- enable full disk encryption using LUKS;
- use a strong password;
- set automatic screen locking after a short period of inactivity;
- avoid leaving your laptop unattended in public spaces.
If a laptop is lost or stolen, disk encryption can prevent direct access to personal files.
Things to check before using a public Wi-Fi network
Before connecting to an unknown network, check:
- Firewall active
- VPN on
- Unnecessary services disabled
- System and applications updated
- Disk encryption enabled
- Automatic screen lock configured
- Browser configured for privacy
With the right settings, a Linux laptop can be safe on public Wi-Fi networks
Linux is appreciated for the control it offers to the user and its flexibility, but maximum security depends on configuration. A Linux laptop used in public spaces must be treated like any other device connected to the internet: with active protections and clear usage rules.
By combining a correctly configured firewall, a VPN, service optimization, and data encryption, Linux users can significantly reduce the risks associated with public Wi-Fi networks.
Applying appropriate security measures helps protect personal and professional information, regardless of the Wi-Fi network you connect to.